I've been trying to get setup with a Python app to programmatically connect to Sharepoint and get a file. End goal is to get the contents of a file in a known location (folder) on a company Sharepoint.
The Microsoft Entra app has the following permission:
Microsoft Graph
- Files.Read.All
- Sites.Read.All
- Sites.Selected
- User.ReadBasic.All
SharePoint
- Sites.Read.All
- Sites.Selected
- User.Read.All
I've been playing around with various endpoints, both in the Python script and Graph Explorer, and do get results when I hit basic site endpoints. The following seems to work and return data: GET https://graph.microsoft.com/v1.0/sites/root/lists
With Python, I've also done graph_client.sites.by_site_id(SITE_ID).get() which works.
Since I'm trying to get a file in a specific folder, I'm trying to get the drive_item_id of that specific folder. I've been trying to get the drive_item_id of any item but can't get a single result back. This function returns a blank value: graph_client.drives.by_drive_id(drive_id).items.by_drive_item_id('root').children.get(request_configuration) even though I get a 200 code. I've done the same in Graph Explorer as well.
How do I get the driveItemId of a specific folder? How do I get the driveItemId of the items at the root level?