I'm trying to delete an Item from a list using the following code:
using System;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointServices.Samples
{
class DeleteListItem
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");
ListItem oListItem = oList.GetItemById(2);
oListItem.DeleteObject();
clientContext.ExecuteQuery();
}
}
}
for any item Id I try to delete, I always get the same message :
Item does not exist. It may have been deleted by another user.