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

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

问题描述

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

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网站和列表,请查看

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

更新:

对于那些使用MS Graph API访问特定SharePoint网站上的默认Drive(以前称为文档"库)的人:

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

您应该查看用于访问 OneDrive .

You should look into the documentation for accessing files on OneDrive.

如问题所述,此终结点为我们提供了私有OneDrive上的文件列表:

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

.../me/drive/root/children

驱动器的工作方式相同,但您应提供要访问的网站的全局ID (而不是me)(全局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图访问SharePoint在线站点中的文档库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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