无法使用Microsoft Graph API访问Sharepoint列表 -

kar*_*rim 3 microsoft-graph

使用Microsoft图形API,特别是sharepoint beta api,我经常遇到问题.我知道它的测试版,但仍然;)

所以问题是当我尝试使用图形浏览器URL中的图谱API访问共享点列表时:GET https://graph.microsoft.com/beta/sites/ {site-id}/lists/{list-id}

所以SiteID我将我的网站租户GUID和列表ID作为Sharepoint List GUID传递,我在Response中不断遇到错误

{"error":{"code":"invalidRequest","message":"提供的id不适合当前主机","innerError":{"request-id":"61efc5b1-88f8-442c-a41d- 7213b587318e","date":"2017-05-10T07:38:04"}}}

如果任何人也遇到过这个问题,请告诉我您已解决的解决方案

Rya*_*egg 9

作为本周API更新集的一部分,网站ID的格式已经发生变化.此处记录了格式,但它包含SharePoint主机名,SPSite.ID和SPWeb.ID作为三元组:

https://graph.microsoft.com/beta/sites/contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8
Run Code Online (Sandbox Code Playgroud)

如果您将主机名添加到ID中,您的呼叫应该重新开始工作.您可以通过发出以下请求来发现主机名:

https://graph.microsoft.com/beta/sites/root/siteCollection/hostname
Run Code Online (Sandbox Code Playgroud)

您现在还可以使用以下搜索语法搜索网站:

https://graph.microsoft.com/beta/sites?search={keyword}
Run Code Online (Sandbox Code Playgroud)