gpt4 book ai didi

node.js - Node JS microsoft-graph-client 返回空数组

转载 作者:太空宇宙 更新时间:2023-11-03 22:21:58 24 4
gpt4 key购买 nike

我使用 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;
});
}

此代码返回空数组:

{"@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":[]}

如果我使用具有此参数的图形浏览器,它工作正常......

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

最佳答案

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

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

希望得到帮助!史蒂夫。

关于node.js - Node JS microsoft-graph-client 返回空数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53481991/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com