I was shared access to a SharePoint folder on our Office 365 site.
The folder is deeply nested. Something like:
http://mycorp.sharepoint.com
Our Docs > Marketing > Company > Images
Inside the "Images" folder are a list of JPGs.
How can I use the Graph API to access this deeply nested folder?
I've tried something like:
https://graph.microsoft.com/v1.0/sites/mycorp.sharepoint.com:/Documents/Marketing/Company/Images:/Items
I feel I'm close but I'm just not sure how to access the nested folder structure.
The format for referencing a path looks like this:
/v1.0/sites/root/drive/root:/{folder path}:/children
Using your example we have the following:
https://graph.microsoft.com/v1.0/sites/root
returns the root site of your SharePoint tenant.
/drive/root
returns default Drive
for the Site
. In this case, /Documents
isn't actually a "folder", it's the default Drive for your root SharePoint
:{folder path}:
should be replaced by the path to the folder you're looking for. In this case /Marketing/Company/Images
. The first :
operator tells SharePoint to treat the following string as a file path. The second :
tells SharePoint where the file path string ends.
/children
returns a list of DriveItem
resources within the folder.
So you're complete URI should look something like this:
/v1.0/sites/root/drive/root:/Marketing/Company/Images:/children