![](/img/trans.png)
[英]Uploading a File to SharePoint Online using Microsoft Graph API
[英]Get a file from SharePoint Online using Microsoft Graph API
在学习图 API 时,我试图使用 Microsoft Graph API 从 SharePoint 文档库中获取文件。
我首先尝试从https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com
访问文档中的Documents
通过执行此 GET 请求:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com/drive/root:/Test:/children
一切都很好,然后我尝试从同一租户内的另一个站点访问文档。 我告诉自己,在遵循 Microsoft 文档时,这是相同的途径。
我首先做了一个测试请求,以确保我可以首先访问我的网站; 这就是我所做的;
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite
在执行该查询时,我得到了200 OK
响应。
其次,我尝试访问驱动器Documents
,这就是我所做的;
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive
再次一切正常。
然后我使用root
关系,后跟目录名称,然后是children
关系; 这是我的要求:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive/root:/Test:/children
但是在执行时,我收到了Bad Request - 400 - 96ms
请帮忙。
谢谢
使用站点相关 url 指定特定站点时,我遇到了同样的问题。
现在我改用 siteId 并且一切都按预期工作:
https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com,91a47a59-db5e-4d17-a689-479ee8905533,274459c9-4c96-42bf-9b96-838ffa387aaa/drive/root:/X:/children
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.