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

StackOverflow https://stackoverflow.com/questions/15790926

سؤال

I am getting error while I try execute get 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.

I have checked and item exist. I am new at client object model. List object show me item count and its fine, I can't just take List Item object.

I know this is something very simple but still I spent so much time at this simply thing.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top