无法使用 User.ReadWrite.All 权限将 /photo/$value 放入 Beta 端点
Can't PUT /photo/$value in Beta endpoint with User.ReadWrite.All permission
我们正在尝试使用图表 API 更新用户照片,但失败了。
我们有一个已授予 User.ReadWrite.All 范围的应用程序(客户端)ID。
以下是我们在身份验证后获得的访问令牌中返回的范围:
"scp": "Mail.Read User.Read User.Read.All User.ReadWrite User.ReadWrite.All"
然后我们可以通过以下方式毫无问题地获取用户照片:
https://graph.microsoft.com/beta/users/{User ID}/photo/$value
但是,我们无法通过 PUT 更新照片:
PUT /beta/users/{User ID}/photo/$value HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer eyJ0eXAiOiJKV1Q...iLCJhbGciOiJHJSA
Content-Type: image/jpeg
Cache-Control: no-cache
响应:403 禁止
{
"error": {
"code": "ErrorAccessDenied",
"message": "AccessDeniedException",
"innerError": {
"request-id": "35d88f98-78cd-42de-973e-0c0c1414da83",
"date": "2016-09-02T23:45:27"
}
}
}
我们认为这应该按照文档工作:
http://graph.microsoft.io/en-us/docs/api-reference/beta/api/profilephoto_update
其中指出:
One of the following scopes is required to execute this API for:
Profile photo of any user in the tenant including the signed-in user -
User.ReadWrite.All
目前仅 User.ReadWrite 范围支持用户个人资料照片更新。有 https://github.com/OfficeDev/microsoft-graph-docs/issues/442 用于更正此文档问题 - User.ReadWrite。不支持全部。
我们正在尝试使用图表 API 更新用户照片,但失败了。
我们有一个已授予 User.ReadWrite.All 范围的应用程序(客户端)ID。
以下是我们在身份验证后获得的访问令牌中返回的范围:
"scp": "Mail.Read User.Read User.Read.All User.ReadWrite User.ReadWrite.All"
然后我们可以通过以下方式毫无问题地获取用户照片:
https://graph.microsoft.com/beta/users/{User ID}/photo/$value
但是,我们无法通过 PUT 更新照片:
PUT /beta/users/{User ID}/photo/$value HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer eyJ0eXAiOiJKV1Q...iLCJhbGciOiJHJSA
Content-Type: image/jpeg
Cache-Control: no-cache
响应:403 禁止
{
"error": {
"code": "ErrorAccessDenied",
"message": "AccessDeniedException",
"innerError": {
"request-id": "35d88f98-78cd-42de-973e-0c0c1414da83",
"date": "2016-09-02T23:45:27"
}
}
}
我们认为这应该按照文档工作: http://graph.microsoft.io/en-us/docs/api-reference/beta/api/profilephoto_update
其中指出:
One of the following scopes is required to execute this API for:
Profile photo of any user in the tenant including the signed-in user - User.ReadWrite.All
目前仅 User.ReadWrite 范围支持用户个人资料照片更新。有 https://github.com/OfficeDev/microsoft-graph-docs/issues/442 用于更正此文档问题 - User.ReadWrite。不支持全部。