gpt4 book ai didi

azure - 无法使用 Microsoft graph API 获取照片

转载 作者:行者123 更新时间:2023-12-02 16:54:54 26 4
gpt4 key购买 nike

我们正在将 Microsoft Azure AD 与我们的应用程序集成。我正在尝试使用 Microsoft Graph API ( https://graph.microsoft.com/v1.0/users/ {id | userPrincipalName}/photo/$value) 获取用户个人资料图片。但它不适合我。我已在应用程序中授予此 API 所需的所有权限,但每次都得到以下响应。你能告诉我我错过了什么配置吗?

回应:

{

"error": {

"code": "ResourceNotFound",

"message": "Resource could not be discovered.",

"innerError": {

"request-id": "dc27c602-5734-4dec-9b2a-8b42d5577073",

"date": "2019-07-02T10:33:42"

}

}

}

谢谢

最佳答案

只有当用户拥有邮箱时才能读取和更新用户的个人资料照片。此外,以前可能使用thumbnailPhoto 属性(使用Office 365 统一API 预览版或Azure AD Graph,或通过AD Connect 同步)存储的任何照片将无法再通过用户资源的Microsoft Graph 照片属性进行访问。更多详情您可以查看official docs here

Microsoft Graph v1.0 retrieves the user's profilePhoto from Exchange Online, not Azure Active Directory. As such, users that don't have a mailbox provisioned in Exchange Online will not have a profilePhoto available

您的案例:

您可以尝试使用流动格式的 Microsoft Graph REST API Beta 版本请求 URL:

https://graph.microsoft.com/beta/users/UserIdOrPrincipalName/photo/$value

请参阅下面的屏幕截图:

Azure Active Directory 个人资料图片:

enter image description here

postman 请求示例:

请求网址:

https://graph.microsoft.com/beta/users/UserIdOrPrincipalName/photo/$value

![enter image description here

要记住的要点:

Make sure you have upload user photo in azure portal profile.

注意:

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported

关于azure - 无法使用 Microsoft graph API 获取照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56851425/

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