如果要查找旧版 SharePoint REST API 文档,请参阅使用 SharePoint REST 终结点完成基本操作。
对于 SharePoint Online,使用 REST API 对 SharePoint 的创新是通过 Microsoft Graph REST API 推动的。 在解决方案已经有可用于访问 SharePoint 内容的访问令牌的方案中,可以在本机 SharePoint 中访问 REST API,而不是通过 Microsoft Graph API 进行调用。
下表列出了 SharePoint Online 支持的一组 Microsoft Graph 终结点。
| Graph URL | SharePoint URL |
|---|---|
https://graph.microsoft.com/v1.0/sites |
https://{tenant-name}.sharepoint.com/_api/v2.0/sites |
https://graph.microsoft.com/v1.0/drives |
https://{tenant-name}.sharepoint.com/_api/v2.0/drives |
https://graph.microsoft.com/v1.0/drive |
https://{tenant-name}.sharepoint.com/_api/v2.0/drive |
https://graph.microsoft.com/v1.0/lists |
https://{tenant-name}.sharepoint.com/_api/v2.0/lists |
如果解决方案已使用其他 Microsoft Graph REST API,则建议通过 Microsoft Graph REST 终结点调用 API,以便更轻松地进行代码管理。
若要确定 SharePoint Online 是否支持 Microsoft Graph REST API 调用,可以将 $whatif 添加到查询的末尾,以输出基础 SharePoint URL。