我尝试连接到 msgraph 以使用 msgraphClientV3 从 spfx Web 部件读取数据。
我想从 /me/memberOf 端点获取结果。 我将这些添加到我的 packageSolution 文件中:
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "User.Read"
},
{
"resource": "Microsoft Graph",
"scope": "User.ReadBasic.All"
},
{
"resource": "Microsoft Graph",
"scope": "Directory.Read.All"
}
]
并用 :
来调用它context.msGraphClientFactory
.getClient("3")
.then((client: MSGraphClientV3): void => {
client.api('/me/memberOf')
.get((error, messages: any, rawResponse?: any) => {
console.log("***********result*********")
if (error)
console.log(error)
else
console.log(messages?.value);
})
})
当我尝试时,我收到此错误消息:
错误:权限不足,无法完成操作。
有人知道我哪里出错了吗?