Access Files in Sharepoint Site by Postman Graph API

Shrikant Bhagwat 81 Reputation points
2025-05-25T01:05:19.24+00:00

Hi I have setup SharePoint Sites in my lab. There are files uploaded to this site

https://shrikantplayground.sharepoint.com/sites/ShrikantSite2

I have Created App in Azure. This is to get list & download files from Postman API

2025-05-24_20-48-10

2025-05-24_20-48-50

What are the next step ? Do I need to do something on SharePoint side ?

Do I need to do Upgrading SharePoint apps from Azure Access Control service to Azure Active Directory ?

Do I need run following :

https://shrikantplayground.sharepoint.com/_layouts/15/AppInv.aspx

I get following error:

https://shrikantplayground.sharepoint.com/_layouts/15/AddinDeprecationAnnoucement.aspx

Let me know

Thanks

Shrikant

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sonny Gillissen 3,996 Reputation points Volunteer Moderator
    2025-05-26T18:40:34.3833333+00:00

    Hi Shrikant Bhagwat

    Thanks for reaching out on Microsoft Q&A!

    No, you don't need to use an add-in, this is the "old" model used by the SharePoint CSOM API. When working with Microsoft Graph you only need an app with the correct permissions, which you seem to have. So this should basically work.

    Getting to the next steps: you basically call the Graph API to retrieve the files, which is done through the 'Drives' part (as SharePoint files are stored on the same technology as OneDrive nowadays therefor drive):

    https://learn.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-1.0&tabs=http

    Please click ‘Accept answer’ if you think my answer is helpful. Feel free to drop additional queries in the comments below!

    Kind regards,

    Sonny


  2. Anonymous
    2025-05-27T09:35:10.4933333+00:00

    Hello @Shrikant Bhagwat

    I understand that you want to call the SharePoint API using Microsoft Graph and want the application to access files only in a specific SharePoint site.

    To achieve it, you need to grant only Sites.Selected API permission to the Microsoft Entra ID application:

    User's image

    Now, create the permission so that the application so that the app can access only one site not all:

    
    POST https://graph.microsoft.com/v1.0/sites/SiteID/permissions
    
    Content-Type: application/json
    
    {
    
      "roles": ["write"],
    
      "grantedToIdentities": [{
    
        "application": {
    
          "id": "ClientIdofApp",
    
          "displayName": "Sharepointapp"
    
        }
    
      }]
    
    }
    
    

    User's image

    Generate the access token:

    
    POST https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
    
    client_id: ClientID
    
    client_secret: Secret
    
    scope: https://graph.microsoft.com/.default
    
    grant_type:client_credentials
    
    

    User's image

    Using the above access token, I am able to access the drive of the particular site successfully:

    
    GET https://graph.microsoft.com/v1.0/sites/SiteID/drive
    
    

    User's image

    If I try to access other SharePoint Site, for which the application does not have access, 403 error occurs:

    User's image

    To download files, refer: Download driveItem content - Microsoft Graph v1.0 | Microsoft

    Let me know if you’re still running into issues or have additional questions.

    Hope this helps!


    If this answers your query, do click Accept Answer and Yes for was this answer helpful, which may help members with similar questions.

    User's image

    If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.


Your answer

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