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

江枫思渺然 提交于 2019-12-02 09:40:13

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/15790926/client-object-model-get-item-by-id-error-item-does-not-exist-it-may-have-been

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!