'Item Does Not Exist' error reading SharePoint 2010 List

ぃ、小莉子 提交于 2019-12-10 10:24:59

问题


I have a list in SharePoint 2010. If I add items to the list programmatically (via a custom webpart), I can later read those items and show them in other web parts. However, if I attempt to read a list item added through the web interface, I get the following error in my webpart:

Item does not exist. The page you selected contains an item that does not exist. It may have been deleted by another user.0x81020016

The weird part is, in the debugger, I see that the list item is properly read. I'm pulling what's left of my hair out over this one.

Any ideas?


Here's the answer for anyone who cares:

I was calling my page like this - mywebpage.aspx?id=1, where id=1 was the id of the item in the list I wanted my webpart to display. For some reason known only to Microsoft, using 'id' in the query string is a no-no. So I changed the param name to 'lid' and now everything works like I would expect.

Thanks for everyone's responses.


回答1:


You are most likely accessing the SPItem with incorrect credentials inside your web app. You should provide proper user impersonation.

Please read my post how to configure web app for impersonation for more details:

WindowsIdentity and Classic .Net App Pool




回答2:


Well, I think I've found it. I was calling my page like this - mywebpage.aspx?id=1, where id=1 was the id of the item in the list I wanted my webpart to display. For some reason known only to Microsoft, using 'id' in the query string is a no-no. So I changed the param name to 'lid' and now everything works like I would expect.

Thanks for everyone's responses.




回答3:


You, as the creator of an item, will have permission to access it. You need to check the permissions on the SharePoint list you are querying to see what permissions the account your code it using to authenticate has on the list for which you are not the author.



来源:https://stackoverflow.com/questions/13184873/item-does-not-exist-error-reading-sharepoint-2010-list

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