question

Dev-8176 avatar image
0 Votes"
Dev-8176 asked Danstan-MSFT commented

Can I get all profilephoto of all users inorganization along with user data in single query from Azure AD?

I am trying to retrieve all the users from the organisation which is working fine but I need to get the profile picture object as well along with the information of the user.
So I need to call api again for every user in order to get the profile picture or is there a way to get profilePhoto in the same "/users" get methods.

Thanks in advance

microsoft-graph-sdkmicrosoft-graph-usersmicrosoft-graph-identity
· 2
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.

Are you using Azure AD Graph or Microsoft Graph?

0 Votes 0 ·

I am using MSAL librabry for authentication and api calls. I am using the PublicClientApplication client to call the APIs. In short I am using Mirosoft Graph to things done.

1 Vote 1 ·

1 Answer

Danstan-MSFT avatar image
1 Vote"
Danstan-MSFT answered Danstan-MSFT commented

Graph has no single endpoint to return all user profile photos. You have to call Get Profile Photo for each user.
So for any list of users, the profile photo can be constructed using https://graph.microsoft.com/v1.0/users/{user-id}/photo/$value


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

Thanks, But that will cause me to call the API nth time for displaying profile pic of n-th users. Thats seems strange I thought API should provide profile photo along with the data. Nevertheless thanks for the support.

0 Votes 0 ·

One more thing can please tell me a way to pass multiple queries in the search method in javscript. I tried to pass with comma(,) separated but that doesn't worked.

0 Votes 0 ·

"error": {
"code": "MailboxNotEnabledForRESTAPI",
"message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise and the caller didn’t specify EHAM shard behavior.",
"innerError": {
"date": "2021-04-01T11:12:18",
"request-id": "922cb4c9-cd75-40d2-9c69-b501c548ab3a",
"client-request-id": "9f2a3cd6-2849-359a-5e46-d5f551e71c1f"
}

I am getting the above error when i am requesting photo using the graph API.Can you please help with the permission that I need to provide at this time.

Thanks

0 Votes 0 ·

If the answer was helpful please consider accepting to help users. For the other issues I suggest you post a new question so that you can get help in a way that will help other too.

0 Votes 0 ·