Skip to content

Instantly share code, notes, and snippets.

@vgrem
Created April 4, 2015 16:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save vgrem/df9c03afa499f268f0aa to your computer and use it in GitHub Desktop.
Example: delete List Item
using (var client = new SPHttpClient(webUri, userName, password))
{
var listTitle = "Tasks";
var itemId = 2;
var endpointUrl = string.Format("{0}/_api/web/lists/getbytitle('{1}')/items({2})",webUri,listTitle,itemId);
var headers = new Dictionary<string,string>();
headers["IF-MATCH"] = "*";
headers["X-HTTP-Method"] = "DELETE";
client.ExecuteJson(endpointUrl,HttpMethod.Post,null,headers);
Console.WriteLine("Task item has been deleted");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment