客户端对象模型度日ID&QUOT项目;项目不存在。它可能已被另一用户QUOT删除; [英] Client object model get item by id "Item does not exist. It may have been deleted by another user"

查看:174
本文介绍了客户端对象模型度日ID&QUOT项目;项目不存在。它可能已被另一用户QUOT删除;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到错误,而我试图通过ID

  ClientContext clientContext = TokenHelper.GetClientContextWithAccessToken(sharepointUrl.ToString执行列表项( )的accessToken); 
的Web网页= clientContext.Web;
clientContext.Load(网络);
clientContext.ExecuteQuery();
clientContext.Load(web.CurrentUser);
clientContext.ExecuteQuery();
的currentUser = clientContext.Web.CurrentUser.Title;
名单_list = web.Lists.GetById(_ListGuid);
clientContext.Load(_list);
clientContext.ExecuteQuery();
Microsoft.SharePoint.Client.ListItem _item = _list.GetItemById(项目编号);
clientContext.Load(_item);
clientContext.ExecuteQuery(); // ERROR HERE
的Response.Write(_item [作者]的ToString());



错误:




项不存在。它可能已被其他用户删除。




项存在,我在客户端对象模型的新,列出对象告诉我的项目数和其优良的,我不能只是采取ListItem对象...我知道这是一件很简单的,但仍然在我这只是事情


解决方案

这个问题是在清单文件的权限,而你正在部署的应用程序时,SharePoint问你关于信任,那么我只好选择列表至极ü要以

$ b操作$ b

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

解决方案

the problem was in the permission in the manifest file, and while you are deploying the app, sharepoint ask you about "trust" then u have to choose the list wich u want to operate with

这篇关于客户端对象模型度日ID&QUOT项目;项目不存在。它可能已被另一用户QUOT删除;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆