Read SharePoint files via Graph API
Requirements: Graph Explorer knowledge needed.
Create App Registration
App Registration will be used to authenticate against Microsoft Graph API.
Permissions
With API Permission "Sites.Selected" you can specify on which SharePoint-Sites the App Registration will have permissions to read/write files and properties.
Get Site ID
To get the site id of your sharepoint sites to to the following link in a Webbrowser:
GET https://<tenantname>.sharepoint.com/sites/<sitename>/_api/site/id
Example: https://lucanoahcaprez.sharepoint.com/sites/SPS-LNC-WebFiles-PROD/_api/site/id
Example XML Response in Browser:
Get Folder ID
Folder IDs can be found using the graph explorer and the Site ID:
GET https://graph.microsoft.com/v1.0/sites/<SiteID>/drives
Example: https://graph.microsoft.com/v1.0/sites/22c1c748-f7e0-4f10-97f4-64b51694a0ca/drives
Example JSON Response from Graph API
Get Folder Documents
Get folder documents and content with graph api:
GET https://graph.microsoft.com/v1.0/sites/<SiteID>/drives/<FolderID>
Example: https://graph.microsoft.com/v1.0/sites/22c1c748-f7e0-4f10-97f4-64b51694a0ca/drives/b!SMfBIuD3EE-X9GS1FpSgypE4hAdzBPVAhzjowjy6CTAFMPrY5yGSRYYXW7Jhy97f
Example JSON Response in Graph Explorer: