cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sajarac
Level 8

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
Super User
Super User

Re: Username Photo

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.
sajarac
Level 8

Re: Username Photo

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

sajarac
Level 8

Re: Username Photo

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

 

 

Super User
Super User

Re: Username Photo

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.
sajarac
Level 8

Re: Username Photo

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!!

sajarac
Level 8

Re: Username Photo

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

Super User
Super User

Re: Username Photo

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.
sajarac
Level 8

Re: Username Photo

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,804)