cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Display name and profile photo in gallery?

How can I display a users name and profile photo in gallery of SharePoint list items?

I have a collumn named "Assessor" and whilst I've got my display name showing, Id also like to display my profile photo.

sudosaurus_0-1625849455491.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @sudosaurus ,
Is your column Assessor a Person column?
If yes, I did a test on my side for your reference(My Person column called persondefault1).

Inside the gallery, add a Image control and set its Image property using below formula:

Note: Actually we can directly use Office365Users.UserPhotoV2(ThisItem.XXX.Email) to display user profile photo. But for avoiding "invalid value for the userId parameter" error, we need to add some judge conditions using If function.

If(
!IsBlank(ThisItem.persondefault1.Email),
If(
Office365Users.UserPhotoMetadata(ThisItem.persondefault1.Email).HasPhoto = true,
Office365Users.UserPhotoV2(ThisItem.persondefault1.Email)
))

valbaimsft_0-1626058292473.png

Then add a Label control inside the gallery and set its Text property to:

ThisItem.persondefault1.DisplayName

valbaimsft_1-1626058342384.png

Best regards,

Allen

View solution in original post

3 REPLIES 3
DylanSimons
Resolver III
Resolver III

you can use the Office365Users connector and the "UserPhotoV2()" function. It is described well in the following link: https://powerusers.microsoft.com/t5/Building-Power-Apps/How-do-I-use-the-the-Office365Users-quot-Use...

v-albai-msft
Community Support
Community Support

Hi @sudosaurus ,
Is your column Assessor a Person column?
If yes, I did a test on my side for your reference(My Person column called persondefault1).

Inside the gallery, add a Image control and set its Image property using below formula:

Note: Actually we can directly use Office365Users.UserPhotoV2(ThisItem.XXX.Email) to display user profile photo. But for avoiding "invalid value for the userId parameter" error, we need to add some judge conditions using If function.

If(
!IsBlank(ThisItem.persondefault1.Email),
If(
Office365Users.UserPhotoMetadata(ThisItem.persondefault1.Email).HasPhoto = true,
Office365Users.UserPhotoV2(ThisItem.persondefault1.Email)
))

valbaimsft_0-1626058292473.png

Then add a Label control inside the gallery and set its Text property to:

ThisItem.persondefault1.DisplayName

valbaimsft_1-1626058342384.png

Best regards,

Allen

sudosaurus
Post Prodigy
Post Prodigy

Thank you @v-albai-msft - very useful to know! 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,115)