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...
- I got access token.
POST https://login.microsoftonline.com/{{tenantName}}/oauth2/v2.0/token
- I tried to get sharepoint list items with the access token I got.
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." }