Here is C# code to delete a particular SharePoint item having ID = 2 from a list named Announcements.
The whole row with ID= 2 will be deleted
The whole row with ID= 2 will be deleted
// Starting with ClientContext, the constructor requires a URL to the
// server running SharePoint.
ClientContext context = new ClientContext("http://SiteUrl");
// Assume that the web has a list named "Announcements".
List announcementsList = context.Web.Lists.GetByTitle("Announcements");
// Assume that there is a list item with ID=2.
ListItem listItem = announcementsList.GetItemById(2);
listItem.DeleteObject();
context.ExecuteQuery(); }
No comments:
Post a Comment