Search code examples
azuremicrosoft-graph-apipostman

Microsoft Graph - Getting data from a SharePoint List


I am trying out Microsoft Graph, I wanted to create a Daemon application that will get data from my List in SharePoint Online, but for now I am trying everything first in PostMan. I am already getting the Access Token using the following

Here is a screenshot of my Postman

And here is my configuration in my Azure AD Portal

App Registration Screenshot

I tried to inspect the Access Token I received in jwt.io and it seems that the roles it has only has the following roles

enter image description here

when I tried the same token in my Graph to get data from SP List, I am getting access Denied

enter image description here

Using the same Access Token I was able to access "https://graph.microsoft.com/v1.0/users" but when I tried to use it to get data from a SP List I am getting the error above

https://graph.microsoft.com/v1.0/users


Solution

  • It looks like a missconfiguration of your app registration. You have assigned SharePoint api specific permissions, based on your provided screenshoot from microsoft entra admin center:

    enter image description here

    What you actualy want are graph permissions.

    Resolving steps:

    1. Open Microsoft Entra admin center
    2. Navigate to app registrations
    3. Select your app
    4. Select api permissions
    5. Click add a permission
    6. Select graph api (over here you previously selected sharepoint)
    7. Select Site.ReadAll

    It should look like this when you´r done:

    enter image description here