通过内置 Web 服务将文件上传到 SharePoint
通过 WSS 3.0 版本公开的内置 Web 服务将文件上传到 SharePoint 服务器上的文档库的最佳方法是什么?
遵循两个初始答案...
我们肯定需要使用 Web 服务层,因为我们将从远程客户端应用程序进行这些调用。
WebDAV 方法适合我们,但我们希望与 Web 服务集成方法保持一致。
另外还有一个用于上传文件的网络服务,虽然很痛苦,但一直有效。
您指的是“复印”服务吗? 我们已成功使用此服务的 CopyIntoItems
方法。 这是否是仅使用 WSS Web 服务 API 将文件上传到文档库的推荐方法?
我已将我们的代码作为建议的答案发布。
What is the best way to upload a file to a Document Library on a SharePoint server through the built-in web services that version WSS 3.0 exposes?
Following the two initial answers...
We definitely need to use the Web Service layer as we will be making these calls from remote client applications.
The WebDAV method would work for us, but we would prefer to be consistent with the web service integration method.
There is additionally a web service to upload files, painful but works all the time.
Are you referring to the “Copy” service?
We have been successful with this service’s CopyIntoItems
method. Would this be the recommended way to upload a file to Document Libraries using only the WSS web service API?
I have posted our code as a suggested answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
使用 WSS“复制”Web 服务将文档上传到图书馆的示例...
Example of using the WSS "Copy" Web service to upload a document to a library...
来自工作中的大学:
From a colleage at work:
不确定到底要使用哪个 Web 服务,但如果您可以使用 SharePoint .NET API Dll,那么使用 SPList 和 SPLibrary.Items.Add 就非常简单。
Not sure on exactly which web service to use, but if you are in a position where you can use the SharePoint .NET API Dlls, then using the SPList and SPLibrary.Items.Add is really easy.
我很幸运地使用了此处描述的 DocLibHelper 包装类: http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html
I've had good luck using the DocLibHelper wrapper class described here: http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html
注意:将
CopyIntoItems
的第一个参数更改为文件名Path.GetFileName(destinationUrl)
会使取消链接消息消失。NOTE: Changing the 1st parameter of
CopyIntoItems
to the file name,Path.GetFileName(destinationUrl)
, makes the unlink message disappear.另一种选择是使用普通的 HTTP PUT:
其中 RemoteFileURL 指向您的 SharePoint 文档库...
Another option is to use plain ol' HTTP PUT:
Where remoteFileURL points to your SharePoint document library...
有几件事需要考虑:
需要文档已存在于某个服务器。 该文档作为 Web 服务调用的参数传递,这将限制文档的大小。 (请参阅http:// Social.msdn.microsoft.com/Forums/en-AU/sharepointdevelopment/thread/e4e00092-b312-4d4c-a0d2-1cfc2beb9a6c)There are a couple of things to consider:
needs the document to be already present at some server. The document is passed as a parameter of the webservice call, which will limit how large the document can be. (See http://social.msdn.microsoft.com/Forums/en-AU/sharepointdevelopment/thread/e4e00092-b312-4d4c-a0d2-1cfc2beb9a6c)