使用图形api beta获取共享点管理中心中列出的所有根网站

sel*_*mar 2 sharepoint outlook graph office365 microsoft-graph

我需要在图像中显示的共享点管理中心中列出的所有根网站 在此输入图像描述

为此,我使用Graph api如下,

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://graph.microsoft.com/beta/sharepoint/sites",
  "method": "GET",
  "headers": {
    "authorization": "Bearer token",
    "cache-control": "no-cache",
    "postman-token": "3116b007-e574-5ad4-aedd-3b35fbf76b61"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
Run Code Online (Sandbox Code Playgroud)

但它输出如下,

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#sharePoint/sites",
  "value": [
    {
      "createdDateTime": "2017-02-18T13:03:01.263Z",
      "description": "",
      "id": "2422c3a2-3c51-40f1-8483-5454aead43c4,412bb897-c754-460a-962d-db22893a1649",
      "lastModifiedDateTime": "2017-04-24T02:16:43Z",
      "name": "",
      "webUrl": "https://mps330124.sharepoint.com",
      "root": {},
      "siteCollection": {
        "hostname": "mps330124.sharepoint.com"
      },
      "siteCollectionId": "2422c3a2-3c51-40f1-8483-5454aead43c4",
      "siteId": "412bb897-c754-460a-962d-db22893a1649"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能实现它使用graph api beta

小智 12

在站点搜索端点上使用星号似乎可行

https://graph.microsoft.com/v1.0/sites?search=*
Run Code Online (Sandbox Code Playgroud)

回报

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
"value": [
    {
        "createdDateTime": "2017-09-15T01:11:50Z",
        "description": "Let's capture our thoughts in this subsite blog.",
        "id": "xyz.sharepoint.com,5a58bb09-1fba-41c1-8125-69da264370a0,5e9767b8-95bc-4bd1-aeb0-defabcdefabc",
        "lastModifiedDateTime": "0001-01-01T08:00:00Z",
        "name": "internalblogs",
        "webUrl": "https://xyz.sharepoint.com/internalblogs",
        "displayName": "Internal blog"
    },
    {   
        ...
    }]
}
Run Code Online (Sandbox Code Playgroud)

  • **重要通知:**这仅适用于v1.0端点,如果在beta端点上使用此功能,则会失败.我也不确定这是否意味着此选项将在未来版本中被删除 (2认同)