Web services 使用CopyIntoItems上载文档时无法更新查找字段

Web services 使用CopyIntoItems上载文档时无法更新查找字段,web-services,sharepoint-2007,Web Services,Sharepoint 2007,我正在尝试使用Copy.asmx webservice(CopyIntoItems方法)从本地计算机上载文档。我可以成功上载文档和DateTime属性,但无法更新文档库的查找属性。我将MOSS 2007与sp2一起使用 我使用的代码如下所示: string[] destinationUrls = { Uri.EscapeUriString(destinationUrl) }; CopySharepointService.FieldInformation dateInformation = ne

我正在尝试使用Copy.asmx webservice(CopyIntoItems方法)从本地计算机上载文档。我可以成功上载文档和DateTime属性,但无法更新文档库的查找属性。我将MOSS 2007与sp2一起使用

我使用的代码如下所示:

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不会将信息放入“文件”、“计算”或“查找”类型的字段中。web服务使用SPCopy类的CopyIntoItem调用名为FieldShouldBeCopiedTo的私有方法。此方法包含防止复制查找字段的逻辑


有时候我讨厌SharePoint。

没办法,伙计们;唯一的替代方法是重新连接,获取列表项本身并以这种方式更新元数据。记住:查找字段需要使用
number的格式#-因此,如果数据是:

12;#Some Option

使用
12#在Xml批处理更新中。

不幸的是,您必须调用设置所有“有趣”元数据

从链接中的示例:

Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

string strBatch = "<Method ID='1' Cmd='Update'>" + 
    "<Field Name='ID'>4</Field>" +
    "<Field Name='Field_Number'>999</Field></Method>" +
    "<Method ID='2' Cmd='Update'><Field Name='ID' >6</Field>" +
    "<Field Name='Field_DateTime'>
        2003-11-11T09:15:30Z</Field></Method>"; 

XmlDocument xmlDoc = new System.Xml.XmlDocument();

System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");

elBatch.SetAttribute("OnError","Continue");
elBatch.SetAttribute("ListVersion","1");
elBatch.SetAttribute("ViewName",
    "0d7fcacd-1d7c-45bc-bcfc-6d7f7d2eeb40");

elBatch.InnerXml = strBatch;

XmlNode ndReturn = listService.UpdateListItems("List_Name", elBatch);

MessageBox.Show(ndReturn.OuterXml);
Web\u Reference\u Folder.Lists listService=新建Web\u Reference\u Folder.Lists();
listService.Credentials=System.Net.CredentialCache.DefaultCredentials;
字符串strBatch=”“+
"4" +
"999" +
"6" +
"
2003-11-11T09:15:30Z”;
XmlDocument xmlDoc=new System.Xml.XmlDocument();
System.Xml.xmlement elBatch=xmlDoc.CreateElement(“批处理”);
elBatch.SetAttribute(“OnError”、“Continue”);
SetAttribute(“ListVersion”、“1”);
SetAttribute(“视图名称”,
“0d7fcacd-1d7c-45bc-bcfc-6d7f7d2eeb40”);
elBatch.InnerXml=strBatch;
XmlNode ndReturn=listService.UpdateListItems(“列表名称”,elBatch);
Show(ndReturn.OuterXml);

您是否有指向示例的链接?