如何使用 MS 图访问共享点在线站点中的文档库 [英] How to access a document library in a sharepoint online site using MS graph

查看:12
本文介绍了如何使用 MS 图访问共享点在线站点中的文档库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过以下请求访问我的一个驱动器上的文档:

I am able to access the documents on my one drive with requests like this one:

https://graph.microsoft.com/v1.0/me/drive/root/children

我可以通过以下请求访问我公司的根共享点站点的文档库:

I am able to access a document library of a root sharepoint site of my company with a request like this:

https://graph.microsoft.com/v1.0/drive/root/children

它给了我根"库的内容:

It gives me the contents of the "root" library:

https://<my company>.sharepoint.com/Shared%20Documents

我无法访问我创建的 SP 子网站的文档库.例如这个:

I am not able to access the document library of a SP subsite I created. e.g. this one:

https://<my company>.sharepoint.com/samplesp/Shared%20Documents

如何使用 MS Graph 访问这样的文档库?

How can I access such a document library with MS Graph?

推荐答案

要访问 SharePoint 网站和列表,请查看 Microsoft Graph 中的 SharePoint API.

For accessing SharePoint sites and lists check out documentation of the SharePoint API in Microsoft Graph.

更新:

对于在使用 MS Graph API 访问特定 SharePoint 网站上的默认驱动器(以前称为文档"库)时遇到问题的用户:

For those who have problems with accessing default Drive (formerly "Documents" library) on a specific SharePoint site using MS Graph API:

您应该查看 OneDrive.

正如问题中所说,此端点为我们提供了私有 OneDrive 上的文件列表:

As said in the question, this endpoint gives us a list of files on private OneDrive:

.../me/drive/root/children

Drive 在 SharePoint 网站上的工作方式相同,但您应该提供您要访问的网站的 global Id 来代替 me(global Id<hostName>,<siteCollectionId>,<siteId>).

Drive on SharePoint's sites works in the same way, but instead of me you should provide global Id of the site you want to access (global Id is <hostName>,<siteCollectionId>,<siteId>).

总结:此端点为我们提供了指定站点默认驱动器上的文件列表:

In conclusion: this endpoint gives us a list of files on a specified site's default drive:

.../Sharepoint/sites/<hostName>,<siteCollectionId>,<siteId>/drive/root/children

如果您想访问特定列表中的文件,您只需要该列表的 id:

If you want to access files on a specific list, all you need is the id of the list:

.../Sharepoint/sites/<hostName>,<siteCollectionId>,<siteId>/lists/<listId>/drive/root/children

现在应该很明显了.

这篇关于如何使用 MS 图访问共享点在线站点中的文档库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆