如何使用 VBA 读取安全的共享点目录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5450469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I read a secure sharepoint directory with VBA?
提问by Aeonaut
I'm trying to write a macro to connect to an https sharepoint directory and read the list of files contained within the directory (so that I can parse the filenames and then open the appropriate one and read some data from it).
我正在尝试编写一个宏来连接到 https 共享点目录并读取该目录中包含的文件列表(以便我可以解析文件名,然后打开相应的文件名并从中读取一些数据)。
So far I've tried:
到目前为止,我已经尝试过:
- Get the content of a sharepoint folder with Excel VBA.
Set folder = fs.GetFolder
seems to work with an http sharepoint, but not an https: sharepoint - http://blog.itwarlocks.com/2009/04/28/accessing-webdav-in-microsoft-word-visual-basic/
getChildren()
doesn't work here. The directory is returned as a simple record (even though it's actually a complex one with a subfolder and files, that should have Children). - connecting to an excel document on the sharepoint and then invoking the shared workspace function. This doesn't return any documents in the directory even though there are several other files in the directory.
- 使用 Excel VBA 获取共享点文件夹的内容。
Set folder = fs.GetFolder
似乎适用于 http 共享点,但不适用于 https:共享点 - http://blog.itwarlocks.com/2009/04/28/accessing-webdav-in-microsoft-word-visual-basic/
getChildren()
在这里不起作用。该目录作为一个简单的记录返回(尽管它实际上是一个带有子文件夹和文件的复杂记录,应该有子文件夹)。 - 连接到共享点上的 excel 文档,然后调用共享工作区功能。即使目录中有几个其他文件,这也不会返回目录中的任何文档。
Has anyone had success with this on a secure https sharepoint directory??
有人在安全的 https 共享点目录上成功了吗?
回答by Karel
Sharepoint exposes webservices. You can use these to iterate through your libraries.
Sharepoint 公开网络服务。您可以使用这些来迭代您的库。
http://msdn.microsoft.com/en-us/library/ms479390(v=office.12).aspx
http://msdn.microsoft.com/en-us/library/ms479390(v=office.12).aspx
Sharepoint 2010 also provides the managed Client Object Model.
Sharepoint 2010 还提供托管客户端对象模型。
This will do what you want: http://msdn.microsoft.com/en-us/library/aa159897(v=office.11).aspx
这将执行您想要的操作:http: //msdn.microsoft.com/en-us/library/aa159897(v=office.11).aspx
回答by Mark Mascolino
If the files you want are in a document library, you could use WebDAV to get access to them via something like: \sp.example.com\sites\thesite\doclib\foldername
如果您想要的文件在文档库中,您可以使用 WebDAV 通过以下方式访问它们:\sp.example.com\sites\thesite\doclib\foldername