cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ck25415
Post Patron
Post Patron

Display people picker field image in gallery

Hi,

 

I have a people picker field in sharepoint called people. If i assign Thisitem.people.picture to an image in gallery does it show the image of the person in the poeple field. If not how can I show it ?

 

Thanks

 

 

 

 

9 REPLIES 9
RandyHayes
Super User III
Super User III

This works fine for me.

 

As a sample (to make sure I wasn't imagining it)

I have a Gallery (Gallery1) with the items coming from a SharePoint list that has a People column in it.

I have an image with the Image property set to Gallery1.Selected.PeopleColumn.Picture

 

All is well...EXCEPT, and this is what I recalled from before. 

SharePoint has its own profile pictures stored in the user profile.  It seems that the user has to actually access SharePoint at some time and then it kicks of something that, behind the scenes, will move the user profile photo from Office 365 over into SharePoint.  This sync takes some time.

Once it is there, the above works fine.  Until then, the picture returned is a placeholder photo.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Oh, any by the way, your example of having the images in the Gallery (ThisItem.People.Picture) works fine too.  With the previous points noted.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hello @RandyHayes

 

Thanks for the quick reply. I have tried Thisitem.People.Picture for an image in the gallery and also set an Image outside the gallery to Gallery.Selected.People.Picture In both cases i dont see any image not even a placeholder image. I have posted similar question couple of weeks ago (no one replied) when I started to see this issue. I did try a different datsource and a different people picker field and also check with different user.

 

Also I have tried below expression set to an image( I have added Office365Users datasource)

 

If(Office365Users.UserPhotoMetadata(ThisItem.People.Picture).HasPhoto=false,SampleImage,Office365Users.UserPhoto(ThisItem.People.Picture))

 

Thanks,

Hmmm, All working here. 

Here is a snip of a Gallery with a sample list of items and a People Column.

The properties are listed at the top row.

 

snipPeople.png

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@ck25415By the way, your Office365Users.UserPhoto syntax/parameter was wrong.  You need to pass the ID (email) of the user to it.  You were passing the Picture.  This would definitely not yield any results.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@ck25415one more thing.  I should have asked this before.  Are you allowing multiple selections of people in your SharePoint column, or no?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@RandyHayes

 

Thanks for the correction, now this expression shows the image of the users but I also see a bad request error message next to the expression.

 

code: BadRequest

message: Unsupported segment type

 

No I am not using multiple selections of people. 

 

Also, one more issue started at the same time, when i set the default property of people picker field in a new form to 

 

{DisplayName:User().FullName,
Claims:"i:0#.f|membership|" & Lower(User().Email),
}

 or 

{DisplayName:User().FullName,
Claims:"i:0#.f|membership|" & Lower(User().Email),
Department:"",
Email:User().Email,
JobTitle:"",
Picture:""}

it does not populate, sharing if this helps in connecting any dots.

 

Thanks,

I see HasPhoto return those errors all the time.  I honestly don't know what that issue is all about.  It seems more of an annoyance than a functional problem in most cases.  But to my users, they don't like seeing an error.  I am hoping one day they will recognize and fix that issue, or...still waiting for better error trapping and handling in PowerApps.

 

On to the other.  Here is the syntax you need to use in a Patch or Update function to update that field properly:

 

YourPeopleColumn:  
{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(User().Email),
Department: "",
DisplayName: User().DisplayName,
Email: User().Email,
JobTitle: ".",
Picture: "."
}
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@RandyHayes

 

Thanks for the expression to patch/update the person field but I would like to see the person field populate and also allow the user to change it if required so I would like to set the default property instead of using patch/update.

 

I did open a microsoft case on the image issue, I will post here if I get any update on it.

 

Thanks,

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (24,138)