Pete Skelly
Pete Skelly

Reputation: 795

Using SharePoint's lists.asmx and UpdateListItems to delete an item by Guid or UniqueId

I am trying to call the lists.asmx UpdateListItems() to delete a list item by unique id or guid. The following batch xml fails with "Invalid URL Parameter. The URL provided contains an invalid Command or Value. Please check the URL again".

<Batch OnError="Continue" ListVersion="1" ViewName="">
  <Method ID="1" Cmd="Delete">
    <Field Name="Guid">7be4a863ce-08de-4506-9c69-400749860e76</Field>
  </Method>
</Batch>

In addition, I have tried with and without enclosing "{}", UrlEncoding, using UniqueId instead of Guid, prefixing the guid with "[id];#", etc. but to no avail.

Using the ID will work, but I would prefer using the Guid if possible:

<Batch OnError="Continue" ListVersion="1" ViewName="">
  <Method ID="1" Cmd="Delete">
    <Field Name="ID">29</Field>
  </Method>
</Batch>

Anyone have any ideas, or is this not possible using the UniqueID or Guid?

Upvotes: 3

Views: 5377

Answers (1)

Kit Menke
Kit Menke

Reputation: 7056

From the documentation, they only give an example using ID... which leads me to believe it probably will not work with anything else.

Upvotes: 2

Related Questions