question

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

Graph API: GET /users/{id or principal}/photo returning Internal Server Error

Hello everybody,

we want to build an app that syncs the profile pics, therefore we create an application with the application permission User.Read.All in Azure AD. We use the java SDK.

 ProfilePhoto stream = graphServiceClient.users(userPrincipal).photo()
                     .buildRequest()
                     .get();

The response is an internal server error.

 Unexpected exception returned from the service.Error code: Unable to parse error response message
 Error message: Raw error: <html><body><b>Http/1.1 Internal Server Error 43524 </b></body> </html>
    
 GET https://graph.microsoft.com/v1.0/users/test@test.com/photo
 SdkVersion : graph-java/v3.5.0
    
    
 500 : Internal Server Error
 Cache-Control : no-cache,no-store
 Connection : close
 Content-Length : 71
 Pragma : no-cache


Are we missing something here? We use TokenCredentialAuthProvider and everything else works.

microsoft-graph-sdk
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.

1 Answer

ShwetaChoudhary-8869 avatar image
1 Vote"
ShwetaChoudhary-8869 answered BenjaminCJohn edited

The 500 status code generally represents a server problem. What we can do is to check whether there is a problem with the step of calling the API, try to call the API in the graph explorer and Postman to check if issue still exists.

Also use same access token that you get from code while calling API through Postman to ensure if there is any issue with token itself.

To check claims on your token, use this - https://jwt.ms/

If your issue still exists, please share your request id and timestamp.

Hope this helps. Thanks!



· 1
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.

Thank you for your support.

When we execute this in Postman, it looks like any Netscaler Gateway service prevents us from accessing the resource. Other resources can be called with the Token we use.
The permission in the Token are
"roles": [
"Directory.Read.All",
"User.Read.All"
],
Unfortunately because of the Netscaler, we don't get a request ID.

But maybe this info already tells, what the problem is about.

Thanks again

0 Votes 0 ·