UpdateListItems在尝试更新sharepoint中的列表时发出错误

时间:2011-11-30 13:49:32

标签: c# sharepoint-2010 sharepoint-api

我正在尝试使用sharepoint list Web服务更新列表。但我收到以下错误

Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
 <Result ID="1,Update">
  <ErrorCode>0x8102000a</ErrorCode> 
  <ErrorText>Invalid URL Parameter. The URL provided contains an invalid Command or Value. Please check the URL again.</ErrorText> 
  </Result>
  </Results>

这是我的代码段

string strViewID = "{46FCE9EB-C789-430F-B1A3-9ACA41FE9BD9}";
            XmlDocument camlDocument = new XmlDocument();
            XmlNode queryNode = camlDocument.CreateElement("Query");
            XmlDocument myListDoc = new XmlDocument();
            XmlElement batchXML = myListDoc.CreateElement("Batch");
            batchXML.SetAttribute("OnError", "Continue");
            batchXML.SetAttribute("ListVersion", "1");
            batchXML.SetAttribute("ViewName", strViewID);

           batchXML.InnerXml = "<Method ID ='1' Cmd='Update'>" + "<Field Name='Title'>Z</Field>" +"<Field Name='Region'>West</Field>"+
               "<Field Name='Size'>Z</Field>" + "<Field Name='Sales'>Z</Field></Method>";    
              XElement sys = XmlElementToXelement(batchXML);
                XElement myListReturn = ws.UpdateListItems("{A30AFD47-7118-4904-A3B9-BCEFF7E3E203}", sys);

请帮忙。

1 个答案:

答案 0 :(得分:6)

您可能想尝试在更新中添加ID列以及其他列,然后重试 -

&LT;字段名称='ID'&gt;您打算更新的字段的ID