Reputation: 21
I'm trying to get data with SharePoint REST API but stucking with "System.UnauthorizedAccessException" error. How can I fix this?
What I did is...
POST https://login.microsoftonline.com/{{tenantName}}/oauth2/v2.0/token
GET https://{{xxx.sharepoint.com}}/sites/{{sitename}}/_api/web/lists/GetByTitle('CSV')/items
With the 2nd command, I got error message like below.
"odata.error": { "code": "-2147024891, System.UnauthorizedAccessException", "message": { "lang": "en-US", "value": "Access denied. You do not have permission to perform this action or access this resource." }
Upvotes: 2
Views: 1101
Reputation: 2091
Check whether the site you requested matches the scope set by app permission xml.It is possible that the scope does not match and the requested site fails to authenticate the request.
Upvotes: 0