不确定这是否会修复该错误消息,但这是您可以使用名称的方式:
名称(对于开箱即用的文档库)内部名称是"BaseName"。
您可以使用 powershell 查找列表中所有列的内部名称:
$web = Get-SPWeb http://yoursiteurl
$web.lists["The List Name"].Fields | FL Title, InternalName
示例查询:
$query.set_innerXML("<Where><Eq><FieldRef Name='BaseName'></FieldRef><Value Type='Text'>" + $ItemName + "</Value></Eq></Where>")
powershell 中的完整示例:
function Update-SPItem($proxy, $ItemName, $listName, $lastModified, $firstName, $lastName, $chID, $emplNumber, )
{
$doc = New-Object System.Xml.XmlDocument
$viewFields = $doc.CreateElement("ViewFields")
$viewFields.set_innerXML("<FieldRef Name='ID'></FieldRef>")
$queryOptions = $doc.CreateElement("QueryOptions")
$queryOptions.set_innerXML("<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><DateInUtc>FALSE</DateInUtc><ViewAttributes Scope='RecursiveAll'/>")
$query = $doc.CreateElement("Query")
$query.set_innerXML("<Where><Eq><FieldRef Name='BaseName'></FieldRef><Value Type='Text'>" + $ItemName + "</Value></Eq></Where>")
$results = $proxy.GetListItems($listName, "", $query, $viewFields, "", $queryOptions, "")
$rowXml = $results.GetElementsByTagName("z:row")
$ItemID = $rowXml.Item(0).GetAttribute("ows_ID")
# Update the item
$batch = $doc.CreateElement("Batch")
$batch.SetAttribute("OnError", "Continue")
$batch.SetAttribute("ListVersion","1")
$batch.SetAttribute("ViewName", "")
$batch.InnerXml = "<Method ID='1' Cmd='Update'><Field Name='ID'>" + $ItemID +
"</Field><Field Name='ImageCreateDate'>" + $lastModified +
"</Field><Field Name='FirstName'>" + $firstName +
"</Field><Field Name='LastName'>" + $lastName +
"</Field><Field Name='CardHolderID'>" + $chID +
"</Field><Field Name='EmployeeNumber'>" + $emplNumber +
"</Field></Method>"
$result = $proxy.UpdateListItems($listName, $batch)
}