I am running a SharePoint Online provider-hosted app, and via CSOM, I am loading the contents of a list with the following code:
var items = List.GetItems(CamlQuery.CreateAllItemsQuery());
By using a
ClientContext with a Bearer Token – ie. using the app model – the request fails. It doesn't matter what user is logged in. I can load properties of the list successfully eg.
List.Title. Only CAML queries fail.
I am certain that I have access to this list. Additionally:
- When constructing a
SharePointOnlineCredentialobject (specifying a username and password explicitly), the request succeeds.
- The same user can view items in the browser.
- All other lists, which have the EXACT SAME security permissions (ie. inheriting), return results successfully.
- Breaking inheritance and explicitly assigning Full Control to Everyone makes no difference.
- It was working previously, but I'm not sure at what point it stopped working. I don't think any changes have been made to either the code or the list.
What could be different about this list that causes Access Denied?