office365office365apimicrosoft-graph-api

Microsoft Graph API - Get profile picture with defined size


I already used a beta version of the unified API to get the profile picture of the user with size of 48x48. Now I'm using the Microsoft Graph API and tried to get the profile picture with this size too. But I only get the 648x648 one... Is there a way to get the picture in 48x48?

this is my request:

https://graph.microsoft.com/v1.0/users/user@domain.com/photo

Here the Documentation: http://graph.microsoft.io/docs/api-reference/v1.0/api/profilephoto_get

Thanks in advance!

Best regards,

AJ


Solution

  • UPDATED

    Get profilePhoto Documentation

    GET /me/photos/{size}/$value
    GET /users/{id | userPrincipalName}/photos/{size}/$value
    GET /groups/{id}/photos/{size}/$value
    

    Sizes

    The supported sizes of HD photos on Microsoft 365 are as follows: 48x48, 64x64, 96x96, 120x120, 240x240, 360x360, 432x432, 504x504, and 648x648. Photos can be any dimension if they're stored in Microsoft Entra ID.

    OLD

    For your own picture you can do:

    https://graph.microsoft.com/v1.0/me/photos('{size}')/$value
    or
    https://graph.microsoft.com/v1.0/me/photos/{size}/$value

    If you would like to retrieve someone else's photo: https://graph.microsoft.com/v1.0/users/{userPrincipalName}/photos/{size}/$value

    Example:

    https://graph.microsoft.com/v1.0/me/photos('48x48')/$value

    The available sizes are '48x48', '64x64', '96x96', '120x120', '240x240', '360x360','432x432', '504x504', and '648x648'.

    I gleaned that from the link that Reken Liu gave in the previous answer