cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Siddz
Super User
Super User

UserPhotoMetadata Error

I have a canvas app with the SharePoint and the Office365Users connectors. I would like to display a user's Office 365 photo in a gallery if the user has a photo, or show a generic profile photo if they don't. The connected SharePoint list includes a person field, which is where the user photos are coming from. 

 

The gallery works as intended by displaying the user's photo if they have one and showing a generic profile image if they don't. However, I'm getting this error when I run the app:

Siddz_2-1642464369954.png

Here's what I have for the Image property on the photo in the gallery:

If(Office365Users.UserPhotoMetadata(ThisItem.SP_Person.Email).HasPhoto = true, Office365Users.UserPhotoV2(ThisItem.SP_Person.Email), 'No-Profile-Photo')

Here's the warning from Power Apps on the formula for the Image property: "This formula uses scope..."

Siddz_1-1642463397002.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Toby124
Frequent Visitor

@Siddz , can you try the expression? 

 

Expression: If(!IsBlank(ThisItem.Email),If(Office365Users.UserPhotoMetadata(ThisItem.Email).HasPhoto=true,Office365Users.UserPhotoV2(ThisItem.Email),SampleImage))

View solution in original post

2 REPLIES 2
Toby124
Frequent Visitor

@Siddz , can you try the expression? 

 

Expression: If(!IsBlank(ThisItem.Email),If(Office365Users.UserPhotoMetadata(ThisItem.Email).HasPhoto=true,Office365Users.UserPhotoV2(ThisItem.Email),SampleImage))

Hi, @Toby124.

 

Thanks! That seems to work. I updated the Image property on the photo in the gallery to this:

 

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

 

Thanks again.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,341)