Microsoft Graph API - Office 365 Access SharePoint Nested Folder Items

拟墨画扇 提交于 2019-12-08 05:37:58

问题


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:

  1. https://graph.microsoft.com/v1.0/sites/root returns the root site of your SharePoint tenant.

  2. /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

  3. :{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.

  4. /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


来源:https://stackoverflow.com/questions/49540406/microsoft-graph-api-office-365-access-sharepoint-nested-folder-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!