问题
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.
回答1:
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/rootreturns the root site of your SharePoint tenant./
drive/rootreturns defaultDrivefor theSite. In this case,/Documentsisn'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./childrenreturns a list ofDriveItemresources within the folder.
So you're complete URI should look something like this:
/v1.0/sites/root/drive/root:/Marketing/Company/Images:/children
来源:https://stackoverflow.com/questions/49540406/microsoft-graph-api-office-365-access-sharepoint-nested-folder-items