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:
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..."
Solved! Go to Solution.
@Siddz , can you try the expression?
@Siddz , can you try the expression?
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.
User | Count |
---|---|
260 | |
110 | |
98 | |
56 | |
40 |