cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to display a specific user's photo

I'm building an app for my team's use and need a way to display their images. How would I do this?

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@hari3,

Based on the issue that you mentioned, do you want to display users's images?

Could you please share a bit more about the scenario?

Office365Users.UserPhotoMetadata() expects the userid(Principal Name/ Email ID) of the user for which we want to search data for.

Please make sure that you are passing correct data inside office365 function. 

In my scenario, I have a SP list containing a Person column named 'Senior' storing the team users.

Add a Gallery and set the Image property as below:

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

ppp.png

Hope it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

3 REPLIES 3
PowerAddict
Super User
Super User

@Anonymous add the Office365Users connector to your app and then use the following expression: 

If(
    !IsBlank(gblUserID),
    Office365Users.UserPhotoV2(gblUserID),
    SampleImage
)

Where gblUserID is a variable that has the user name of the user for whom you want to display a photo. 

For example, if you have a gallery of users, the expression would change to:

If(
    !IsBlank(ThisItem.'User Name'),
    Office365Users.UserPhotoV2(ThisItem.'User Name'),
    SampleImage
)

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Anonymous
Not applicable

Hi, I put the full name of the user in place of gblUserID but it still won't display their picture?

v-qiaqi-msft
Community Support
Community Support

Hi@hari3,

Based on the issue that you mentioned, do you want to display users's images?

Could you please share a bit more about the scenario?

Office365Users.UserPhotoMetadata() expects the userid(Principal Name/ Email ID) of the user for which we want to search data for.

Please make sure that you are passing correct data inside office365 function. 

In my scenario, I have a SP list containing a Person column named 'Senior' storing the team users.

Add a Gallery and set the Image property as below:

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

ppp.png

Hope it could help.

Regards,

Qi

Best Regards,
Qi

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 (2,856)