设置列表项的ContentTypeId会抛出SoapException

时间:2012-05-09 17:20:43

标签: web-services list sharepoint sharepoint-2010

执行以下操作:

XmlDocument xmlDoc = new XmlDocument();
            XmlElement updates = xmlDoc.CreateElement("Batch");
            updates.SetAttribute("OnError", "Continue");
            updates.SetAttribute("ListVersion", "0");
            updates.SetAttribute("ViewName", "");

updates.InnerXml = "<Method ID=\"1\" Cmd=\"Update\">" +
                "<Field Name=\"ID\">" + listItemId + "</Field>" +
                "<Field Name=\"Title\">ModifiedFile</Field>" +
                "<Field Name=\"FileRef\">" + theFileInSharepoint + "</Field>"+
                "<Field Type=\"ContentTypeId\">" + contentTypeId + "</Field></Method>";

myListSoapClient.UpdateListItems(myListGuid, updates);

如果更新包含<Field Type=\"ContentTypeId\">节点,则UpdatelistItems将抛出(抛出类型为'Microsoft.SharePoint.SoapServer.SoapServerException'的异常。)。删除它,并应用更新。

是否可以通过sharepoint的web服务修改listItem ContentTypeId?

0 个答案:

没有答案