如何使用 CopyIntoItems 将文件复制到现有的 doclib 项目中
这是我的场景:我需要使用其 Web 服务将文件复制到共享点文档库并在其上设置元数据。除了 Lookup 字段之外,这一切都可以通过 CopyIntoItems(来自 Copy webservice)实现。 CopyIntoItems 会忽略它们,因此我需要另一种方法来设置这些字段的数据。
我尝试使用必填字段和查找字段元数据创建一个列表项,然后使用项目 ID(使用 ID 创建 FieldInformation 字段以及其他一些简单元数据),调用 CopyIntoItems 方法,而不是更新该项目,sharepoint 创建了一个新项目。
我无法以相反的顺序执行此操作,因为我无法从 CopyIntoItems 创建的项目中获取 ID...
所以,问题是:如何将文件上传到共享点文档库并设置其所有元数据?包括查找字段。
This is my scenario: I need to copy files to a sharepoint document library using its web services and set metadata on them. That's all possible with CopyIntoItems (from Copy webservice) except for Lookup fields. CopyIntoItems ignores them, so i need another way to set data on those fields.
I've tried to create a list item with the mandatory and lookup fields metadata and then, using the item ID (creating a FieldInformation field with the ID, as well as some other simple metadata), called the CopyIntoItems method and, instead of updating the item, sharepoint created a new one.
I can't do this in the reverse order because i have no way to get the ID from the item created by CopyIntoItems...
So, the question is: How can i upload a file to a sharepoint document library and set all its metadata? Including Lookup fields.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WebRequest
到 将文档上传到库中有用链接:将文件上传到 SharePoint 文档库并更新任何元数据列
WebRequest
to to upload the document into the libraryHelpful link: Uploading files to the SharePoint Document Library and updating any metadata columns
请记住,如果目标文件夹项目计数 + 祖先文件夹项目计数超过列表视图阈值,则您无法查询列表中的 ID(Kit 答案中的步骤 2)。
如果将查询限制在文件夹层次结构中的特定分支,则可以更有效地完成查询。解决方法是修改站点设置,但查询会很缓慢,并且会降低解决方案的可移植性,因为 Office365 和 BPOS 的阈值无法更改。
这更好地解释了它: http://office.microsoft.com/en-us/office365-sharepoint-online-enterprise-help/create-or-delete-a-folder-in -a-列表或库-HA102771961.aspx
Keep in mind that if the destination folder item count + the ancestor folders item count exceeds the list view threshold then you can't query the list for the id (step 2 from Kit's answer).
Queries can be done more efficiently if constrained to a particular branch in the folder hierarchy. A workaround would be to modify the site settings, but the queries would be sluggish and would make the solution less portable because the threshold for Office365 and BPOS can't be changed.
This explains it much better: http://office.microsoft.com/en-us/office365-sharepoint-online-enterprise-help/create-or-delete-a-folder-in-a-list-or-library-HA102771961.aspx