cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yvsuhas
Frequent Visitor

Get Email Address from People Picker field and update Email field when people picker changes

I'm failry new to PowerApps and have ample experince with Infopath forms. I have a people picker field which is called "Employee" and I want to get the default user profile properties of the user selected in that Employee field. I'm able to set the people picker field to the current logged in user using the following code in the DefaultSelectedItems property of the DatacardValue22.

 

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

 

Because the primary text of the peoplepciker field is DisplayName, it is working fine and showing my name but I want to get the Email and other properties from the user profile and show them in respective text fields which will be disabled on the form. I'm not able to acheive that and also the properties need to update when I change the value of the 'Employee' Poeple Pciker field. Please help me on how to acheive this.

 

NOTE: There should be definitely a cleaner way to approach the set current user properties part but being new, I'm not entirely sure of that, I tried few ways using global variables and failed. I created the PowerApp from the studio and used a modern list as a datasource and I don't have the SharePoint Integrator yet as still PowerApps is not generally available to our environment as we have 'Classic Mode' at the tenant level.

1 ACCEPTED SOLUTION

Accepted Solutions
yvsuhas
Frequent Visitor

I found the answer and it is the following text in the Default property.

 

Office365Users.UserProfileV2(DataCardValue22.Selected.Email).mail

View solution in original post

9 REPLIES 9
K-A-R-L
Solution Specialist
Solution Specialist

Hi @yvsuhas,

 

I'll assume you are using form instead of gallery. Can you please unlock the DataCard, go to Advanced and set DisplayFields of your Card: People Picker to this:

["Email","DisplayName","Picture"]

If you are using gallery please let me know.

Cheers

 

 

v-monli-msft
Community Support
Community Support

Hi @yvsuhas ,

 

Set the DisplayFields from ["DisplayName","Email","Picture"] to:

["Email","Picture"]

Capture.JPG

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
yvsuhas
Frequent Visitor

Hi @K-A-R-L ,

 

Thank you for responding. I'm using a form and my display fields are set to the values "["DisplayName","Email","Picture"]" for the Employee data card value but I'm not able to extract the Email address from the field as something like Employee.Email or DataCardValue22.SelectedItems.Email. I also need other properties like Department, Job Title and Phone Number as well.

 

Regards,

Suhas

Hi @v-monli-msft ,

 

Is there a reason to remove "DisplayName" from the display fields of the person data card?

 

Thanks,

Suhas

yvsuhas
Frequent Visitor

I found the answer and it is the following text in the Default property.

 

Office365Users.UserProfileV2(DataCardValue22.Selected.Email).mail

View solution in original post

Selected.Email is not possible..

Ash2
Helper II
Helper II

How would you get the email add for fields with multiple user?

kellboy222
Regular Visitor

So my own issue is unique. Please take a look at the screenshot below

kellboy222_0-1619056171549.png

So I'm trying to return the email value from a people column on SharePoint but I cant seem to find the email value of the People column from Powerapps. I noticed this happens to me with certain SharePoint List.. Please any Ideas.. 

kellboy222
Regular Visitor

So I was able to resolve this by manually typing in the "Email" value ie "test. Email"   and it worked. Not sure why the Email isn't showing from the dropdown. 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

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

Top Solution Authors
Top Kudoed Authors
Users online (47,646)