简体   繁体   English

如何使用MS图访问sharepoint在线站点中的文档库

[英]How to access a document library in a sharepoint online site using MS graph

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

I am not able to access the document library of a SP subsite I created. 我无法访问我创建的SP子网站的文档库。 eg this one: 例如这一个:

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

How can I access such a document library with MS Graph? 如何使用MS Graph访问这样的文档库?

For accessing SharePoint sites and lists check out documentation of the SharePoint API in Microsoft Graph . 要访问SharePoint网站和列表,请查看Microsoft Graph中的SharePoint API文档。

Update: 更新:

For those who have problems with accessing default Drive (formerly "Documents" library) on a specific SharePoint site using MS Graph API: 对于那些使用MS Graph API访问特定SharePoint站点上的默认驱动器(以前称为“文档”库)有问题的用户:

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: 如问题中所述,此端点为我们提供了私有OneDrive上的文件列表:

.../me/drive/root/children

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> ). 开车在SharePoint网站上的作品以同样的方式,但不是me ,你应该为你要访问的网站的全球ID( 全球编号<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

If you want to access files on a specific list, all you need is the id of the list: 如果要访问特定列表中的文件,您只需要列表的ID:

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

Now it should be obvious. 现在应该是显而易见的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 MS Flow 在 sharepoint 在线文档库中查找文件夹是否存在 - How to find if folder exists in sharepoint online document library using MS Flow 如何访问共享点在线站点中的所有文档库/文件夹/文件 - How to access all document libraries/folder/files in a sharepoint online site 如何通过Microsoft Graph API访问Sharepoint站点的文档库? - How to access Sharepoint site's document library via Microsoft Graph API? 如何通过Microsoft Graph API访问Sharepoint通讯站点的文档库? - How to access Sharepoint communication site's document library via Microsoft Graph API? 如何在Sharepoint Framework(SPFx)应用程序中使用Excel Rest API访问存储在Sharepoint联机文档库中的Excel数据? - How to access Excel Data stored in Sharepoint Online Document Library using Excel Rest API in a Sharepoint Framework (SPFx) app? 如何使用SharePoint Online的SharePoint REST API访问默认的SharePoint图像库? - How do I access the default SharePoint image library by using the SharePoint REST API for SharePoint Online? 将 CSV 文件从 SharePoint Online 文档库导入 Access 数据库 - Import a CSV file into Access database from SharePoint Online Document Library 通过图形 API 创建文档库(在 Sharepoint 站点内)? - Create document library (inside Sharepoint site) through graph APIs? 如何通过Microsoft Graph API迭代Sharepoint站点的文档库项目? - How to iterate Sharepoint site's document library items via Microsoft Graph API? SharePoint Online:使用CSOM获取文档库子项计数 - SharePoint Online: Get Document Library Children Count Using CSOM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM