Office 365 图形 api /sites/search 不返回所有网站

rue*_*ehr 7 microsoft-graph-api

我发现图形 api /sites?search= 调用的行为不一致。

这是一个例子:

https://graph.microsoft.com/v1.0/sites?search=

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
    "value": [
        {
            "createdDateTime": "2017-09-15T10:53:07Z",
            "id": "fake.sharepoint.com,67f79958-537d-4611-85b1-9e24c53db8e8,82dc47eb-9ab0-40eb-9ad6-49bb62983710",
            "lastModifiedDateTime": "2017-09-15T10:57:26Z",
            "name": "companydrive",
            "webUrl": "https://fake.sharepoint.com/sites/Fake/companydrive",
            "displayName": "Company Drive"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

客户端请求 ID - afbfb651-8776-4561-a554-5777ff3ecf07

这似乎不正确,因为我可以看到其他网站:

管理控制台

我可以尝试直接引用一个网站:

https://graph.microsoft.com/v1.0/sites/fake.sharepoint.com/:/
Run Code Online (Sandbox Code Playgroud)

它实际上返回一个结果:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites/$entity",
    "createdDateTime": "2017-09-10T18:55:05.853Z",
    "description": "",
    "id": "fake.sharepoint.com,c814fb30-d5f8-40ad-acf5-2cb270b27723,d9ced640-50f8-49b7-b138-41bc4469edf3",
    "lastModifiedDateTime": "2018-03-07T16:32:48Z",
    "name": "",
    "webUrl": "https://fake.sharepoint.com",
    "root": {},
    "siteCollection": {
        "hostname": "fake.sharepoint.com"
    },
    "displayName": "Fake Limited Team Site"
}
Run Code Online (Sandbox Code Playgroud)

在我看来,sites?search= 调用没有返回正确的网站列表。这是一个错误吗?

Nel*_*and 0

您似乎正在使用 Graph API 的测试端点调用 SharePoint 网站。我推荐使用 v1.0:

GET /sites/{site-id}/drive/root/search(q='{search-text}')
Run Code Online (Sandbox Code Playgroud)

https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http