sharepointsplistitem

How to update SharePoint List Item with no ID column


I am trying to update a status filed in a SharePoint list. Did some googling, found most of the examples are using an ID column to locate the list item, but my list doesn't have such column, only a windows login and a status columns. I am wondering what the XML would be like?

This is what I come up with, but it doesn't work:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
  <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">       
    <listName>SPUsers</listName>
    <updates>
      <Batch PreCalc='TRUE' OnError='Continue'>
        <Method ID="1" Cmd="Update">
          <Field Name="ID">ABC</Field>
          <Field Name="ItemStatus">Completed?ID=ABC</Field>
        </Method>
      </Batch>
    </updates>
  </UpdateListItems>
</soapenv:Body>
</soapenv:Envelope>

This is the result:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
  <UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    <UpdateListItemsResult>
      <Results>
        <Result ID="1,Update">
          <ErrorCode>0x80004005</ErrorCode>
          <ErrorText>Cannot complete this action.  Please try again.</ErrorText> 
        </Result>
      </Results>
    </UpdateListItemsResult>
  </UpdateListItemsResponse>
</soap:Body>
</soap:Envelope>

Any idea what went wrong?

Thank you.


Solution

  • SharePoint will generate list item ID automatically, the default view just not show the ID field, you could go to list view settings to show the field so you could know the ID.

    enter image description here