使用Microsoft图形API,特别是sharepoint beta api,我不断遇到问题。我知道它的测试版,但仍然;)
问题是当我尝试使用图形浏览器中的Graph API访问sharepoint列表时 网址为:GET https://graph.microsoft.com/beta/sites/ {site-id} / lists / {list-id}
所以SiteID我将我的网站租户GUID和列表ID作为Sharepoint List GUID传递 我在Response
中不断面对错误{ “错误”:{ “code”:“invalidRequest”, “message”:“提供的id不适合当前主机”, “innerError”:{ “request-id”:“61efc5b1-88f8-442c-a41d-7213b587318e”, “约会”:“2017-05-10T07:38:04” } } }
如果任何人也遇到过此问题,请告诉我您已解决的解决方案
答案 0 :(得分:9)
网站ID的格式已经改变,作为本周API更新集的一部分。新的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}
答案 1 :(得分:0)
尝试https://graph.microsoft.com/beta/sites/{siteCollectionId},{siteId}/lists
您可以从https://graph.microsoft.com/beta/site/sites
答案 2 :(得分:0)
@Ryan Gregg的答案正确
SiteId 不仅是一个 GUID ,而且是
示例:<contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8>
以上示例中的整个字符串是您应在请求中为{SiteId}传递的内容
如果您没有SPSite.ID,但具有网站的URL,则可以进行GRAPH API调用,并带有相对于网站的相对路径
https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/Documetation
此调用将返回该网站的所有属性,您可以从此处获取完整的 SiteId :
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites/$entity",
"createdDateTime": "2020-04-23T12:18:48.653Z",
"description": "Documentation",
"id": "contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8",
"lastModifiedDateTime": "2020-12-09T19:17:21Z",
"name": "Documentation",
"webUrl": "https://contoso.sharepoint.com/sites/Documentation",
"displayName": "Documentation",
"root": {},
"siteCollection": {
"hostname": "contoso.sharepoint.com"
}
}