question

Dewde avatar image
0 Votes"
Dewde asked saldana-msft edited

Microsoft Graph profile picture fetching broke

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-usersmicrosoft-graph-general
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is your account a personal account or a work account?

0 Votes 0 ·
Dewde avatar image Dewde CarlZhao-MSFT ·

API call is done on a personal AD and the queried account is a personal account

0 Votes 0 ·

@Dewde Please refer to my answer, metadata operation for personal accounts is not supported.

0 Votes 0 ·

1 Answer

CarlZhao-MSFT avatar image
0 Votes"
CarlZhao-MSFT answered Dewde commented

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.



image.png (41.2 KiB)
image.png (14.8 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If so, how come it worked for many months before it broke on its own? And how stupid is that anyway? A user logging in my app and the app is not allowed to fetch that user's profile picture? Where else do you see such API behavior? Twitter? No. Facebook? No. Google? No. Furthermore, my app is asking for User.Read and profile grants which ALLOW the reading of the profile pic.

1 Vote 1 ·

Hi @Dewde I am referring to the MS graph api official doc, I am not sure if the doc has been updated in the last few months. But this is only specific to the photo's metadata though, you can of course get the profile photo of a personal account logged into the application, try calling: /me/photo/$value or /me/photos/48x48/$value api endpoint to get photos.

0 Votes 0 ·
Dewde avatar image Dewde CarlZhao-MSFT ·

But this is only specific to the photo's metadata though, you can of course get the profile photo of a personal account logged into the application

No, you can't, just tried. I get the same error for GET https://graph.microsoft.com/v1.0/me/photos/48x48/$value. Both were working 3 months ago



0 Votes 0 ·