首页 文章

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

提问于
浏览
3

使用Microsoft图形API,尤其是sharepoint beta api,我不断遇到问题 . 我知道它的测试版,但仍然;)

所以问题是当我尝试使用Graph Explorer中的Graph API访问sharepoint列表时,网址是:GET https://graph.microsoft.com/beta/sites/ / lists /

所以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“}}}

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

2 回答

  • 0

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

    https://graph.microsoft.com/beta/sites/contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8
    

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

    https://graph.microsoft.com/beta/sites/root/siteCollection/hostname
    

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

    https://graph.microsoft.com/beta/sites?search={keyword}
    
  • 7

    试试 https://graph.microsoft.com/beta/sites/{siteCollectionId},{siteId}/lists

    你可以在 https://graph.microsoft.com/beta/site/sites 找到这些ID

相关问题