节点 JS microsoft-graph-client return 空数组

Node JS microsoft-graph-client return empty array

我使用 MS Bot Framework 和 MS Graph.. 我需要从 Sharepoint 列表中获取数据。 我使用此代码:

    async getMe() {
    return await this.graphClient
        .api('/sites/site.sharepoint.com/sites/site.sharepoint.com,9a51e995-62f9-4b40-81c2-d167c4c79182,2646bdf6-214f-482c-826f-c5e21676a79c/lists/84885DBF-980E-4AD2-8377-AAB746E6D41A/items')
        .version('beta')
        .expand('fields')
        .get().then((res) => {
            return res;
        });
}

此代码return空数组:

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#sites('site.sharepoint.com')/sites('site.sharepoint.com%2C9a51e995-62f9-4b40-81c2-d167c4c79182%2C2646bdf6-214f-482c-826f-c5e21676a79c')/lists('84885DBF-980E-4AD2-8377-AAB746E6D41A')/items","value":[]}

如果我将 Graph Explorer 与此参数一起使用,它可以正常工作...

图形客户端示例 - https://github.com/microsoftgraph/msgraph-sdk-javascript

将您的 .api() 更改为如下所示:https://graph.microsoft.com/beta/sites/{site}.sharepoint.com:/teams/{sitename}:/lists

在将 .api() 值更改为上述示例时,我能够通过 MS Graph 成功访问 SharePoint 列表。请注意每个正斜杠前的“:”(冒号)。它是一个必要的组件。

希望得到帮助! 史蒂夫