我正在尝试使用 Copy.asmx 网络服务、CopyIntoItems 方法从本地计算机上传文档。我可以成功上传文档和 DateTime 属性,但无法更新文档库的查找属性。我正在使用带有 sp2 的 MOSS 2007
我正在使用的代码如下所示:
string[] destinationUrls = { Uri.EscapeUriString(destinationUrl) };
CopySharepointService.FieldInformation dateInformation = new CopySharepointService.FieldInformation();
dateInformation.DisplayName = "Date";
dateInformation.Type = CopySharepointService.FieldType.DateTime;
dateInformation.Value = DateTime.Today.ToString();
CopySharepointService.FieldInformation fundInformation = new CopySharepointService.FieldInformation();
fundInformation.DisplayName = "Fund";
fundInformation.Type = CopySharepointService.FieldType.Lookup;
fundInformation.Id = new Guid(fundGuidItem); // This is the GUID of the field being updated in the document library
fundInformation.Value = "1";
CopySharepointService.FieldInformation[] info = { dateInformation, fundInformation };
CopySharepointService.CopyResult[] result;
CopySharepointService.CopySoapClient CopyService2007 = new CopySoapClient("CopySoap");
CopyService2007.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
CopyService2007.CopyIntoItems(destinationUrl, destinationUrls, info, fileData, out result);
文档已成功上传,但查阅字段未更新
有人可以帮忙吗?
最佳答案
我刚刚找到了这个线程:
“不幸的是,CopyIntoItems 不会将信息放入"file"、“计算”或“查找”类型的字段中。Web 服务使用 SPCopy 类的 CopyIntoItem,它调用一个名为 FieldShouldBeCopiedTo 的私有(private)方法。此方法包含防止逻辑查找字段不会被复制。”
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/2fdc9933-ddb8-446f-80ad-6c8e17dfdb6f
我有时讨厌 SharePoint。
关于web-services - 使用 CopyIntoItems 上传文档时无法更新查找字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1915188/