要访问 SharePoint 网站和列表,请查看以下文档Microsoft Graph 中的 SharePoint API https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/sharepoint.
Update:
对于那些在使用 MS Graph API 访问特定 SharePoint 网站上的默认驱动器(以前称为“文档”库)时遇到问题的用户:
您应该查看有关访问文件的文档OneDrive https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_list_children.
正如问题中所述,此端点为我们提供了私有 OneDrive 上的文件列表:
.../me/drive/root/children
SharePoint 网站上的 Drive 的工作方式相同,但不是me
你应该提供全局 ID您要访问的网站的名称(全局 ID is <hostName>,<siteCollectionId>,<siteId>
).
总之:此端点为我们提供了指定站点的默认驱动器上的文件列表:
.../Sharepoint/sites/<hostName>,<siteCollectionId>,<siteId>/drive/root/children
如果你想访问特定列表上的文件,你只需要列表的 id:
.../Sharepoint/sites/<hostName>,<siteCollectionId>,<siteId>/lists/<listId>/drive/root/children
现在应该很明显了。