Microsoft Graph profile picture fetching broke

Dewde 6 Reputation points
2022-04-12T19:14:15.087+00:00

This used to work fine but broke down during the past 3 months. The code didn't change, the user didn't change. Seemingly Graph did.

PHP SDK

$user = $graph->createRequest('GET', '/me/photos/48x48')->setReturnType(Model\User::class)->execute();

results in

Client error: GET https://graph.microsoft.com/v1.0/me/photos/48x48 resulted in a 404 Not Found response:
{"error":{"code":"UnknownError","message":"{\r\n \"errorCode\": \"ErrorProfileNotFound\",\r\n \"message\": \"Exception of type 'Microsoft.Fast.Profile.Core.Exception.ProfileNotFoundException' was thrown.\",\r\n \"target\": null,\r\n \"details\": null,\r\n \"innerError\": null,\r\n \"instanceAnnotations\": []\r\n}","innerError":{"date":"2022-04-12T18:13:30","request-id":"44c9baba-8213-4587-a7d0-4793432bca1b","client-request-id":"44c9baba-8213-4587-a7d0-4793432bca1b"}}}

What can it be?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,100 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 39,021 Reputation points
    2022-04-13T08:03:15.91+00:00

    Hi @Dewde

    I can reproduce your problem:

    192578-image.png

    This is because personal Microsoft accounts do not support metadata operations and you need to log in with a work account.

    192642-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.