Sebastian 506563 Sebastian 506563 - 11 months ago 79
C# Question

Client object model get item by id "Item does not exist. It may have been deleted by another user"

I am getting error while i try execute list item by id

ClientContext clientContext = TokenHelper.GetClientContextWithAccessToken(sharepointUrl.ToString(), accessToken);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
clientContext.Load(web.CurrentUser);
clientContext.ExecuteQuery();
currentUser = clientContext.Web.CurrentUser.Title;
List _list = web.Lists.GetById(_ListGuid);
clientContext.Load(_list);
clientContext.ExecuteQuery();
Microsoft.SharePoint.Client.ListItem _item = _list.GetItemById(ItemID);
clientContext.Load(_item);
clientContext.ExecuteQuery(); //ERROR HERE
Response.Write(_item["Author"].ToString());


error :


Item does not exist. It may have been deleted by another user.


item exist, i am new at client object model, List object show me item count and its fine, i cant just take ListItem object... i know this is something very simple but still i spent so much time at this simply thing

Answer Source

The problem was in the permission in the manifest file, and while you are deploying the app, SharePoint asks you about "trust" then you have to choose the list which you want to operate with.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download