Microsoft Graph API - Office 365 访问 SharePoint 嵌套文件夹项目 [英] Microsoft Graph API - Office 365 Access SharePoint Nested Folder Items
问题描述
我被共享访问我们 Office 365 网站上的 SharePoint 文件夹.
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
图片"文件夹内是 JPG 列表.
Inside the "Images" folder are a list of JPGs.
如何使用 Graph API 访问这个嵌套很深的文件夹?
How can I use the Graph API to access this deeply nested folder?
我尝试过类似的方法:
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.
推荐答案
引用路径的格式如下:
/v1.0/sites/root/drive/root:/{folder path}:/children
使用您的示例,我们有以下内容:
Using your example we have the following:
https://graph.microsoft.com/v1.0/sites/root
返回您的 SharePoint 租户的根网站.
https://graph.microsoft.com/v1.0/sites/root
returns the root site of your SharePoint tenant.
/drive/root
返回 Site
的默认 Drive
.在这种情况下,/Documents
实际上并不是一个文件夹",它是您的根 SharePoint 的默认驱动器
/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}:
应替换为您要查找的文件夹的路径.在本例中为 /Marketing/Company/Images
.第一个 :
运算符告诉 SharePoint 将以下字符串视为文件路径.第二个 :
告诉 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
返回文件夹内的 DriveItem
资源列表.
/children
returns a list of DriveItem
resources within the folder.
所以你的完整 URI 应该是这样的:
So you're complete URI should look something like this:
/v1.0/sites/root/drive/root:/Marketing/Company/Images:/children
这篇关于Microsoft Graph API - Office 365 访问 SharePoint 嵌套文件夹项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!