使用 CopyIntoItems 上传文档时无法更新查找字段 [英] cannot update lookup field when uploading document using CopyIntoItems

查看:39
本文介绍了使用 CopyIntoItems 上传文档时无法更新查找字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Copy.asmx 网络服务(即 CopyIntoItems 方法)从本地计算机上传文档.我可以成功上传文档和 DateTime 属性,但无法更新文档库的查找属性.我正在使用带有 sp2 的 MOSS 2007

I am trying to upload a document from my local machine using the Copy.asmx webservice, the CopyIntoItems method. I can successfully upload the document and a DateTime property but I cannot update a lookup property of the document library. I am using MOSS 2007 with sp2

我使用的代码如下所示:

The code I am using is shown below:

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);

文档上传成功但查找字段未更新

The document is successfully uploaded but the lookup field is not updated

有人可以帮忙吗?

推荐答案

我刚刚找到这个帖子:

不幸的是,CopyIntoItems 不会将信息放入File"、Computed"或Lookup"类型的字段中.Web 服务使用 SPCopy 类的 CopyIntoItem,它调用名为 FieldShouldBeCopiedTo 的私有方法.该方法包含防止查找字段被复制的逻辑."

"Unfortunately, the CopyIntoItems will not put information into fields of "File", "Computed" or "Lookup" types. The web service uses the SPCopy class's CopyIntoItem which makes a call to a private method called FieldShouldBeCopiedTo. This method contains the logic prventing Lookup fields from being copied."

http:///social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/2fdc9933-ddb8-446f-80ad-6c8e17dfdb6f

有时我讨厌 SharePoint.

I hate SharePoint sometimes.

这篇关于使用 CopyIntoItems 上传文档时无法更新查找字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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