Cannot query data in SharePoint using Rest Api

Pavel Brokhman 6 Reputation points
2020-08-12T20:41:48.803+00:00

I have been using this in-4-steps-access-sharepoint-online-data-using-postman-tool article for some time to get access token to get data from SharePoint. It worked fine. However, now I have client where I try to do the same and I am getting following exception, when I try run Rest Api. Access Token was sent to me correctly. Is there anything else I might missing for this client?

{
    "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."
        }
    }
}
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,868 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Baker Kong-MSFT 3,801 Reputation points
    2020-08-13T02:38:20.203+00:00

    Hi PavelBrokhman-0975,

    I am able to reproduce this issue.

    17314-2.jpg

    After go through the blog again i find that there is a mistake:

    17297-image.png

    The permission should be :

    <AppPermissionRequests AllowAppOnlyPolicy="true">  
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />  
    </AppPermissionRequests>  
    

    After I grant the permissions again, it works well!

    17256-1.jpg

    17279-image.png

    So can you grant permissions again to see if it works? Also you may have a look this blog.

    Best Regards,
    Baker Kong

    0 comments No comments

  2. Pavel Brokhman 6 Reputation points
    2020-08-13T14:44:51.323+00:00

    I did see this issue with the missing tag and when I added the trusted application I have put it in before creation.

    Also, I have reviewed this blog as well and tenant configuration set to Allow for both options mentioned in the blog.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.