尝试在 SharePoint 站点中创建文件夹时出现以下错误:
{
"error": {
"code": "accessDenied",
"message": "Access denied",
"innerError": {
"request-id": "61d3b5aa-857e-4ee2-9d0d-51d235ca7c5f",
"date": "2020-05-18T06:31:54"
}
}
}
注意事项:
- 使用 Microsoft Graph Explorer 时,请求有效。
- 对 Graph 端点的其他请求有效。
- 我使用
msgraph-sdk-php
发出请求。 这通常与权限有关,但我的用户具有以下权限 天蓝色的权限设置:
Sites.Manage.All Delegated. Sites.Read.All Delegated. Sites.ReadWrite.All Delegated.
在 my.env 中我有以下权限:
OAUTH_SCOPES='openid profile offline_access user.read calendars.readwrite mail.readwrite mail.send'
网址:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?%20state={someState}%20&scope=openid%20profile%20offline_access%20user.read%20calendars.readwrite%20mail.readwrite%20mail.send%20&response_type=code&approval_prompt=auto&redirect_uri=http://localhost:8080/office365/token/store%20&client_id={myclientId}
是什么导致了这里的错误?
最佳答案
您需要在 OAUTH_SCOPES 变量中添加一个或多个所需范围(Sites.Read.All、Sites.ReadWrite.All、Sites.Manage.All):
OAUTH_SCOPES='Sites.Manage.All ...'
因此您的授权 URL 是这样构建的:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?scope=Sites.Manage.All ...&client_id=...
PS:上述范围均不需要 admin consent .
关于php - "Access denied"Microsoft Graph 制作文件夹时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61863841/