Powershell和Sharepoint和updatelistitems()exception

我有一个问题,我不断得到

"Exception calling "UpdateListItems" with "2" argument(s): "Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown." 

每当我打电话$service.updatelistitems($listname, $xml) 。 我在网上冲浪,看到一些人有类似的问题。 我的sharepoint列表被称为Autos, Title字段被重命名为Make和一个附加的字段名Model ,都是简单的string字段。

有人知道我为什么不能更新我的清单吗? 阅读清单工作得很好。

  $uri = 'http://myServerName/sandbox/_vti_bin/lists.asmx?wsdl' $listName = 'Autos' # car list cls # Create the service $service = New-WebServiceProxy -Uri $uri -Namespace SpWs -UseDefaultCredential # Create xml query to retrieve list. $xmlDoc = new-object System.Xml.XmlDocument $query = $xmlDoc.CreateElement("Query") $viewFields = $xmlDoc.CreateElement("ViewFields") $queryOptions = $xmlDoc.CreateElement("QueryOptions") $query.set_InnerXml("FieldRef Name='Full Name'") $rowLimit = "1000" $list = $null $service = $null try{ $service = New-WebServiceProxy -Uri $uri -Namespace SpWs -UseDefaultCredential } catch{ Write-Error $_ -ErrorAction:'SilentlyContinue' } # Now, we use the service object to retrieve the list. if($service -ne $null){ try{ $list = $service.GetListItems($listName, "", $query, $viewFields, $rowLimit, $queryOptions, "") } catch{ Write-Error $_ -ErrorAction:'SilentlyContinue' } } # $list.data.row ($list.data.row).count # Get name attribute values (guids) for list and view $ndlistview = $service.getlistandview($listname, "") $strlistid = $ndlistview.childnodes.item(0).name $strviewid = $ndlistview.childnodes.item(1).name # Create an xmldocument object and construct a batch element and its attributes. $xmldoc = new-object system.xml.xmldocument # note that an empty viewname parameter causes the method to use the default view $batchelement = $xmldoc.createelement("Batch") # Capital B $batchelement.setattribute("onerror", "continue") $batchelement.setattribute("listversion", "1") $batchelement.setattribute("viewname", $strviewid) # Specify methods for the batch post using caml. to update or delete, specify the id of the item, # and to update or add, specify the value to place in the specified column $xml = "" $xml += "<method ID='1' cmd='Update'>" + "<field name='ID'>1</field>" + "<field name='Title'>Subaru</field>" + "<field name='Model'>Outback</field>" + "</method>" # Set the xml content $batchelement.innerxml = $xml $ndreturn = $null # $ndreturn = $service.updatelistitems($strlistid, $batchelement) # no change using listID $ndreturn = $service.updatelistitems($listName, $batchelement)