Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

We are integrating Microsoft Azure AD with our application. I am trying to get user profile pic using Microsoft Graph API (https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/photo/$value) . But its not working for me. I have given all permission required for this API in application but every time getting below response. Can you please let me what configuration I missed.

Response:

{

    "error": {

        "code": "ResourceNotFound",

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

        "innerError": {

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

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

        }

    }

}

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

Reading and updating a user's profile photo is only possible if the user has a mailbox. Additionally, any photos that may have been previously stored using the thumbnailPhoto property (using the Office 365 unified API preview, or the Azure AD Graph, or through AD Connect synchronization) are no longer accessible through the Microsoft Graph photo property of the user resource. For more details You could check 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

Your Case:

You could try with Microsoft Graph REST API Beta version request URL in flowing format:

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

See the screen shot below:

Azure Active Directory Profile Picture:

enter image description here

Post Man Request Example:

Request URL:

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

![enter image description here

Points To Remember:

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

Note:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...