1

I have a sharepoint list with around 75 columns and there are about 1800 records. I am trying to update an item using Update List Item Web Service but it fails showing errorcode : 0x80004005 and errorText : Cannot complete this action. However, when I try to manually update my item from EditForm.aspx the update happens successfully.

Below is my code to update list item :

<Batch OnError="Continue" ListVersion="1">
        <Method ID="1" Cmd="Update">
            <Field Name="ID">1819</Field>
            <Field Name="Title">xyz</Field>
        </Method>
</Batch>

I get the following response on executing the above query.

<?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</ErrorText>
     </Result>
   </Results>
 </UpdateListItemsResult>
 </UpdateListItemsResponse>

2 Answers 2

1

I haven't used BatchCmd that much, because there's very little help from SharePoint when it goes wrong (as it's executed directly in owssvr.dll, not in any managed code), but I notice a lack of SetVar nodes in your XML.

Try using the example on this page to format your XML: http://msdn.microsoft.com/en-us/library/cc404818(v=office.12).aspx

Such that your XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>
  <ows:Batch OnError="Return">
    <Method ID="[YOUR ITEM ID]">
      <SetList>[YOUR LIST GUID]</SetList>
      <SetVar Name="Cmd">Save</SetVar>
      <SetVar Name="ID">[YOUR ITEM ID]</SetVar>
      <SetVar Name="urn:schemas-microsoft-com:office:office#Title">xyz</SetVar> 
    </Method>
  </ows:Batch>
1

If this is truly your XML, then you are missing a forward-slash on the end </Field> tag for ID.

3
  • Well spotted, OP try this dude's solution first, it'll leave you with less refactoring than mine.
    – James Love
    Aug 24, 2013 at 10:05
  • Hi Matthew, I have update the question with the missing forward slash. Still I am getting the same error.
    – Joyal4
    Aug 24, 2013 at 21:59
  • Also, instead of using Batch cmd I tried using SPServices to update list item. Still I received the same error.
    – Joyal4
    Aug 24, 2013 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.