cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NamegomJan
Helper II
Helper II

Retrieve email address from profile name

Hi everyone,

 

I have a Gallery which has a Sharepoint list as a source. In this sharepoint list I have a person field with a Office365 User where the name is mentioned in this format: Jon Doe 

 

Is there a way to get the related profile picture just from the name?

Is there a way to get the email address just from the name?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@NamegomJan No, it will not show the picture of user who created gallery. It was just an example to show the profile picture of user who created list item in SharePoint list. For your case, you need to use the name of your Person or Group field instead of 'Created By'.

 

Let's say the name of your person or group field is Assigned To then you will use below formula:

 

If(IsBlankOrError(ThisItem.'Assigned To'.Picture), SampleImage, ThisItem.'Assigned To'.Picture)

 

 

Or if the name of your field is Approver then you will change your formula like: 

 

If(IsBlankOrError(ThisItem.Approver.Picture), SampleImage, ThisItem.Approver.Picture)

 

So, you just have to change the name of your person or group field in above formula.

Note: If there is space in your field name then you need to enclose it within single quotes (like given in above example for Assigned To)


Please click Accept as solution if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

View solution in original post

6 REPLIES 6
ganeshsanap
Memorable Member
Memorable Member

Hi @NamegomJan, What is the data type of your field in SharePoint? Person or Group field or something else (like Single line of text)?

 

You can search for office 365 user and fetch email address by passing user name, something like:

Office365Users.SearchUser({searchTerm: UserName})

Where UserName is the name of your user in SharePoint.

 

ReferenceSearch for users 

You can fetch the email address of user from returned result and store it in UserEmail variable. Then you can use below formula to get profile picture using email address.

Office365Users.UserPhotoV2(UserEmail)

 ReferenceAdding users Office365 profile picture to PowerApp 


Please click Accept as solution if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Hi @ganeshsanap,

 

thanks for your help.

 

The data type is Person or Group.

 

Office365Users.SearchUser({searchTerm: UserName})

 

But how can I fetch the current User Name automatically? I have a Gallery and thisitem.fieldname did not work.

 

Office365Users.SearchUser({searchTerm: ThisItem.FieldName})

 

Thanks!

@NamegomJan, If you are using Person or Group field then you can get the profile picture easily using Picture property on Person or Group field.

Example: I am showing the profile picture of user who created list item in Gallery

 

Profile pic of user field.png

Formula used:

 

 

ThisItem.'Created By'.Picture

 

If any user has no Profile picture then you can show SampleImage instead of profile picture using below formula:

If(IsBlankOrError(ThisItem.'Created By'.Picture), SampleImage, ThisItem.'Created By'.Picture)

Please click Accept as solution if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Thanks but this will only show you the picture of the user created the Gallery.

 

What I want to do is show the picture of the person which is mentioned in my Sharepoint list. And every record has some other user.

 

Thanks!

@NamegomJan No, it will not show the picture of user who created gallery. It was just an example to show the profile picture of user who created list item in SharePoint list. For your case, you need to use the name of your Person or Group field instead of 'Created By'.

 

Let's say the name of your person or group field is Assigned To then you will use below formula:

 

If(IsBlankOrError(ThisItem.'Assigned To'.Picture), SampleImage, ThisItem.'Assigned To'.Picture)

 

 

Or if the name of your field is Approver then you will change your formula like: 

 

If(IsBlankOrError(ThisItem.Approver.Picture), SampleImage, ThisItem.Approver.Picture)

 

So, you just have to change the name of your person or group field in above formula.

Note: If there is space in your field name then you need to enclose it within single quotes (like given in above example for Assigned To)


Please click Accept as solution if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Thank you so much. It worked!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,269)