Graph api not returning user profile photo

Bilal Imdad 6 Reputation points
2021-12-07T12:52:40.707+00:00

We are using following endpoint to user profile photo
https://graph.microsoft.com/v1.0/users/{userprincipalname}/photo/$value
we are getting following response
Response: {\r\n "errorCode": "ImageNotFound",\r\n "message": "Exception of type 'Microsoft.Fast.Profile.Core.Exception.ImageNotFoundException' was thrown.",\r\n "target": null,\r\n "details": null,\r\n "innerError": null,\r\n "instanceAnnotations": []\r\n}

Microsoft Security Microsoft Graph
{count} vote

2 answers

Sort by: Most helpful
  1. Preeti Teotia 106 Reputation points Microsoft Employee
    2023-04-06T15:41:18.1166667+00:00

    If profile pic is not uploaded, it should return picture of initials, but it's not returning. It's just returning error "image not found". Please help to understand, how for some users it is returning initials and for others returning error "image not found".

    2 people found this answer helpful.
    0 comments No comments

  2. CarlZhao-MSFT 46,371 Reputation points
    2021-12-08T01:54:27.567+00:00

    Hi @Bilal Imdad

    This is because your user has not yet added a photo, please add a photo for your user before obtaining it. You need to find the user in Azure AD and edit his profile.

    155739-image.png

    155776-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.