Web services 设置列表项的ContentTypeId会引发SoapException

Web services 设置列表项的ContentTypeId会引发SoapException,web-services,list,sharepoint,sharepoint-2010,Web Services,List,Sharepoint,Sharepoint 2010,执行以下操作: XmlDocument xmlDoc = new XmlDocument(); XmlElement updates = xmlDoc.CreateElement("Batch"); updates.SetAttribute("OnError", "Continue"); updates.SetAttribute("ListVersion", "0"); updates.SetAttr

执行以下操作:

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);
XmlDocument xmlDoc=new XmlDocument();
xmlement updates=xmlDoc.CreateElement(“批处理”);
updates.SetAttribute(“OnError”、“Continue”);
updates.SetAttribute(“ListVersion”、“0”);
updates.SetAttribute(“ViewName”和“”);
updates.InnerXml=“”+
“”+listItemId+“”+
“修改文件”+
“”+文件共享点+“”+
“+contentTypeId+”;
myListSoapClient.UpdateListItems(myListGuid,更新);
如果更新包含
节点,则UpdatelistItems将引发(引发类型为“Microsoft.SharePoint.SoapServer.SoapServerException”的异常)。删除该选项,然后应用更新


是否可以通过sharepoint web services修改listItem ContentTypeId?

是否尝试更新项目的内容类型id?我所做的是更新项目的内容类型,如下所示:“1SubFolderMyFolder New”。不知道你想做什么,是的。正在尝试更新列表项的contenttype。谢谢。与之类似的东西也起到了作用:“+listItemId+”ModifiedFile0“+contentTypeName+”,但我仍然想知道为什么直接修改contenttypeid不起作用。从WebServiceList架构文档看,这应该是可能的,很高兴听到这一点!嗯,我认为这是不可能的,因为contenttypeid是(可能的)只读字段。不确定,但不是“项目属性”,而是“内容类型属性”,因此您必须修改内容类型,而不是项目。不确定。我的意思是,ContentType和ContentTypeID道具不一样。祝您好运!