Hello Thierry S,
Thank you for contacting Microsoft Support!
To download a file from SharePoint using the with Microsoft Graph, you can indeed use the GET /drives/{drive-id}/items/{item-id}/content
endpoint.
Here are the steps you can follow:
- Get the SharePoint Site ID: First, you need to get the SharePoint Site ID. You can do this by using the following request:
GET https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{sitename}?$select=id
- Get the Drive ID: Then you need to get the drive ID of the SharePoint document library. You can do this by using the following request:
This will return a list of drives, and you can find the drive ID for the document library where your file is located.GET https://graph.microsoft.com/v1.0/sites/{site-id}/drives
- Get the Item ID: Once you have the drive ID, you can get the item ID using the SharePoint-specific ID. Use the following request:
GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/
- Download the File: Finally, use the Microsoft Graph API to download the file:
GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/content
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.