cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sajarac
Kudo Kingpin
Kudo Kingpin

Username Photo

Hello, 

 

Quick question:

In my table I have a field "username" that field gets the values of my PowerAPP user = User()FullName, for every record added I get the person name.

 

What I would like to add is in the gallery show the name and also the person who submitted the record "Picture"

 

I have been trying different methods but none of them works.

 

My Userfield name is "Initials"

 

Is this correct?

Office365Users.UserPhoto(User().Initials) 

 

And BTW if no the user has no picture I would like to show NO Picture or Empty image.

 

thanks in advance

8 REPLIES 8
Jeff_Thorpe
Super User
Super User

Here is an example of a formula I use in an Image control to get a user's photo. In my example I have a field called cboPeoplePicker where a user is selected and then an Image control that display's the user's photo. You should be able to make a few minor changes to the formula to get it to work in your situation.

 

 

If(IsBlank(cboPeoplePicker.Selected.Mail),
    SampleImage,
    If(Office365Users.UserPhotoMetadata(cboPeoplePicker.Selected.Mail).HasPhoto = true,
        Office365Users.UserPhoto(cboPeoplePicker.Selected.Mail),
        SampleImage
    )
)

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

hi,

 

Thank you very much for your prompt reply.

 

Could you please indicate where my field "Initials" which is store the user name goes in this formula:

 

Thanks in advance

Well, I think that this formula won;t work, because in my field I am getting "User().FullName", and that is Name, Last. and the created field is Last, Name. or maybe yes?

 

Sorry I am confused

 

 

You need the mail address of the user you want to display the photo. In my case my field (cboPeoplePicker) was a people picker, so the selected user had a mail property I could use. If I only needed the current user's mail address I could use "User().Email" instead of "cboPeoplePicker.Selected.Mail".



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Thanks again. Well still nothing.

 

Sorry. again I am trying to show the picture of each person who submitted an especific record in a gallery.

 

I don't kow what I am doing wrong.

 

Sorry to be a pain!!

Hello there, I have been playing with this formula for almost 4 hours, but unfprtunately nothing.

 

Let me recap my situation:

 

My APP is connected with an SPL, I have in that list a field named "Initials" that field is = User().FullName, so in my share point point list I have recorded each record an at the end the column initials "Name and Last Name".

 

Now I would like to ADD to my Gallery the picture of the person who submitted that record using that Field "Initials"

 

Is this possible to do this using your formula?

 

Here is what I am using but I am getting "Invalid Argument Type"

 

If(IsBlank(User().Email),
SampleImage,
If(Office365Users.UserPhotoMetadata(User().Email).HasPhoto = true,
Office365Users.UserPhoto(User().Email),
SampleImage
)
)

 

Thanks in advance for any response.

 

Regards

I just put the code in your post into an image control and it displayed my picture without any errors.

 

If(IsBlank(User().Email),
  SampleImage,
  If(Office365Users.UserPhotoMetadata(User().Email).HasPhoto = true,
    Office365Users.UserPhoto(User().Email),
    SampleImage
  )
)


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Good morning, 

thank you very much for your follow up.

 

for me is not working:

 

error.png

 

I was working on a different solution but is not working also:

 

Because I am collecting User().FullName, I have created a new Sharepoint list with two columns

 

Users  and Email

 

User has the Fullname, and email their email address.

 

I was planning to have a text field with a VLookup function something like:

 

error2.png

 

but that is not working also, and after that insert your proposed image field

 

Regards,

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

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (36,283)