Home > Software engineering >  Failed to retrieve users profile photo and Upload to Azure Blob storage
Failed to retrieve users profile photo and Upload to Azure Blob storage

Time:05-30

I am trying to fetch profile photo of users through Ms Graph by running below query:

https://graph.microsoft.com/beta/users/USER_Name/photo

After retrieving photos of the required users, I have copied photos in the disk. I want to upload it to Azure blob programmatically

I have created a storage account. I have registered an application in Azure AD for connecting to Ms Graph. I have provided the required permissions.

But I am stuck at fetching profile photo itself.

Could anyone help me on achieving the above scenarios?

CodePudding user response:

To retrieve the profile photo of a user via Ms Graph please try the below query:

https://graph.microsoft.com/beta/users/UPN/photo/$value

I have tried to reproduce the same in my environment and got profile photo successfully like below:

image

To upload pictures to the Azure blob storage, you can refer the below link for more information in detail:

Use Microsoft Graph to Retrieve Users Photos and Store Them as Azure Blobs With C# – Mihai-Albert.com

  • Related