1

I am trying to use the call http web service in sharepoint designer to delete a list item on a subsite( for example, when a list item is deleted on subsite 1 delete item on subsite 2). for this example the target list i want to delete the item is called "Test".

I am able to read and create new items on this list(using call http Get and Post methods) just having issues using the delete method. what i have done below for the delete action is as follows. 3 dictionaries.

  • Dictionary 1(Header) contains 2 strings accept and Content-type both with values set to "application/json;odata=verbose".
  • Dictionary 2(metadata) contains 1 string called type and its value is "SP.Data.TestListItem".
  • Dictionary 3 (parameters) contains _metadata variable and ID variables.

For the call http web service action the url is set to "https://mystiteurl.sharepoint.com/subsite2/_api/web/lists/getbytitle('test')/GetItemById(ID)" with the Http method set to "http delete". The request header is set to the dictionary variable mentioned above "header" and the Request content is set to the "parameters" variable.

can anyone point me in right direction to where I am going wrong I have searched a lot of forums and there does not seem to be any examples for the delete action.

1 Answer 1

2

You shouldn't need anything in the RequestContent field.

Set RequestType to HTTP POST.

Set RequestHeaders to your Dictionary 1 dictionary. You already have the Accept and Content-Type headers in this dictionary. But you need to add the X-HTTP-Method header and set its value to DELETE. And also add the IF-MATCH header and set its value to *.

Get rid of the other dictionaries.

5
  • Hi Submits , thanks for reply , i made the changes you suggested set RequestType to HTTP POST and deleted the 2 dictionary's and added the X-HTTP- Method but still the item is not deleting on the other list. any suggestions where i still could be going wrong ?
    – derek
    Jun 1, 2016 at 10:49
  • Sorry, the RequestType should be set to POST, not HTTP POST. I've amended my answer. Try again. Also if you put a variable in for the RequestResponse because then you can see what the error is, if any.
    – Submits
    Jun 1, 2016 at 11:04
  • i cant seem to change the RequestType to POST the options are a dropdown list HTTP POST , HTTP Get, HTTP DELETE, HTTP PUT. error code i get is "{"error":{"code":"-1, Microsoft.SharePoint.Client.ClientServiceException","message":{"lang":"en-US","value":"The request ETag value '' does not match the object's ETag value '\"1\"'."}}}"
    – derek
    Jun 1, 2016 at 11:17
  • I've updated my answer. You need the IF-MATCH header.
    – Submits
    Jun 1, 2016 at 11:31
  • perfect that worked, strange that you dont use the HTTP DELETE method to delete list items just wonder what it is actually used for , anyways really appreciate your help and quick responses , thank you
    – derek
    Jun 1, 2016 at 11:44

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.