Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Asalk
Frequent Visitor

How to Add Employee Profile Picture from Office 365 (Teams, Outlook..etc) to Report?

Hello,

I'm trying to retrieve/embed employee profile picture from Office 365 inside a Power BI report. I tried all the methods mentioned previously in the community but to no avail. I know PowerApps has a O365 connector, but I couldn't find anything similar in Power BI. And when adding pictures from Azure AD the pictures are cropped (not showing correctly) as i'm assuming some of them are exceeding the 32K character limit. 

Should I go with a PowerApp based solution for this problem? Did any of you succeed in importing employee profile pictures from Azure AD?


Best,


1 ACCEPTED SOLUTION

Hi @Asalk,

 

If you can use binary data in Power Query to embed images in Power BI reports, then you need to consider the maximum string length limit allocated in Power BI for string length.

We know that we can't store Base64 characters (Text representation of the image) more than 32,677 characters, so as a workaround, we have to store this information in multiple rows and chunks. Each of the cells will have less than 32,677 characters, and at last, we will reassemble these cells into a single DAX measure. The idea is to remove the text limitation using the DAX measure.

This blog post shares an intuitive way to embed images with complete original size. Please see: COMPLETE GUIDE TO EMBED IMAGES IN POWER BI REPORTS 

 

 

Also you may try to use Power Apps to meet this:

You can use Office 365 users connector, and enter the formula:

If(Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto=true,Office365Users.UserPhoto(ThisItem.Id),SampleImage)

(ID generally refers to a person's email address, If there is no avatar, the sample image is the default image.)

For more information, you can refer to the video :PowerApps - Display Office 365 User Profile Picture

 

Hope it helps,

 

Caitlyn Yan

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@amaitchandak, thank you but this solution does not work as the pictures stored there are not showing correctly. I think because binary to base64 size limitation but i'm not sure.

Do you have any other solution?

Thank you!

Hi @Asalk,

 

If you can use binary data in Power Query to embed images in Power BI reports, then you need to consider the maximum string length limit allocated in Power BI for string length.

We know that we can't store Base64 characters (Text representation of the image) more than 32,677 characters, so as a workaround, we have to store this information in multiple rows and chunks. Each of the cells will have less than 32,677 characters, and at last, we will reassemble these cells into a single DAX measure. The idea is to remove the text limitation using the DAX measure.

This blog post shares an intuitive way to embed images with complete original size. Please see: COMPLETE GUIDE TO EMBED IMAGES IN POWER BI REPORTS 

 

 

Also you may try to use Power Apps to meet this:

You can use Office 365 users connector, and enter the formula:

If(Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto=true,Office365Users.UserPhoto(ThisItem.Id),SampleImage)

(ID generally refers to a person's email address, If there is no avatar, the sample image is the default image.)

For more information, you can refer to the video :PowerApps - Display Office 365 User Profile Picture

 

Hope it helps,

 

Caitlyn Yan

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much! it worked perfectly :).

Hi Asalk. How did you get this employee profile picture?

 

I've tried different methods but I couldn't get these pictures. Using Active Directory in Power BI, pictures are diferent from Azure Active Directory (Microsoft Entra).
I'll be greatfull if you can share how to get it 😁

Asalk
Frequent Visitor

Hi,

I honestly don't remember exactly, but I do remember we ended up saving the pictures somewhere on the server and using Base64 to png. I think that was the only solution we came up with. 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.