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".
Graph api not returning user profile photo
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
2 answers
Sort by: Most helpful
-
Preeti Teotia 106 Reputation points Microsoft Employee
2023-04-06T15:41:18.1166667+00:00 -
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.
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.