在 Access 中刷新 Sharepoint 链接的表? [英] Refresh Sharepoint-linked Table in Access?

查看:89
本文介绍了在 Access 中刷新 Sharepoint 链接的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 2007 年有一个链接到共享点列表的访问表.将新记录添加到共享点列表时,更改不会自动反映在访问表中.如果您在链接表上单击鼠标右键,则会出现一个刷新列表"选项,该选项完全符合您的预期.

I have an access table in 2007 that is linked to a sharepoint list. When a new record is added to the sharepoint list, the change does not get automatically reflected in the access table. If you right click on the linked table, there is an option to "refresh list" which does exactly as you would expect.

我的问题是如何使用 powershell 或类似的东西以编程方式执行此选项?(.netish)

My question is how to perform this option programatically with powershell or something similar? (.netish)

补充:

我发现 acCmdRefreshSharePointList 作为执行刷新列表"选项的一种方式存在.我正在尝试将它与 powershell 一起使用:

I have found that acCmdRefreshSharePointList exists as a way to execute the "refresh list" option. I am attempting to use it with powershell:

$app = New-Object -ComObject access.application
$app.OpenCurrentDatabase("C:\foo.accdb")

$acCmd = "acCmdRefreshSharePointList" 
$app.DoCmd.RunCommand($accCmd)

我希望最后一行会刷新共享点链接表.但是,我收到以下错误:

I would hope that that last line would cause the sharepoint-linked table to refresh. However, I receive the following error:

使用1"参数调用RunCommand"的异常:类型不匹配.(来自 HRESULT 的异常:0x80020005(DISP_E_TYPEMISMATCH))"在行:1 字符:22+ $app.DoCmd.RunCommand <<<<($acCmd)+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullQualifiedErrorId : ComMethodTargetInvocation

Exception calling "RunCommand" with "1" argument(s): "Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))" At line:1 char:22 + $app.DoCmd.RunCommand <<<< ($acCmd) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ComMethodTargetInvocation

任何人都可以阐明我可能做错了什么,或刷新此列表的替代方法吗?

Can anybody shed light on what I could be doing wrong, or alternative methods of refreshing this list?

推荐答案

您正在加载带有文本字符串的 Powershell 变量,该字符串是它不知道的 Access 常量的名称.尝试使用常量的值代替:

You're loading the Powershell variable with a text string which is the name of an Access constant it doesn't know about. Try it with the constant's value instead:

$acCmd = 626
$app.DoCmd.RunCommand($accCmd)

这篇关于在 Access 中刷新 Sharepoint 链接的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆