How to get a User Profile Image from the Microsoft Graph

I have been seeing a few people ask how to get a profile image from the Microsoft Graph…. They’re usually just 1 step away from figuring it out.

Most will use the following to get the photo:

The above returns the following information about the image but not the image itself:

"@odata.context": "$metadata#users('48d31887-5fad-4d73-a9f5-3c356e68a038')/photo/$entity",
"@odata.mediaContentType": "image/jpeg",
"@odata.mediaEtag": "\"2E24ABF6\"",
"id": "240X240",
"height": 240,
"width": 240

If you want the image, you need to add “$value” to the end.$value

The above will return your image.


Note: You need a work or school account for this to work.