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

Pull User Information based on AD LastName, FirstName

Hi everyone,

 

I had created this post earlier, but I think it didn't get created. Couldn't find the post even when I searched for it, so giving it another go. 

 

I have a PowerApps form that is connected to a SharePoint Online list (please reference below):

 

image.png

 

 

The Default value for the Email Address field is:
First(Office365Users.SearchUser({searchTerm:Name.Text})).Mail

 

The Default values for Job Title and Department are similar, except the end of the string is replaced by .JobTitle and .Department.

 

This works great to return information for most users, but our organization has a group of users whose names follow a different naming standard, and their Display Names are ABCLastName, FirstName, and email addresses are FirstName.ABCLastName@Organization.com.

 

So when I use the above form to return user data, in order for the search to work, I'd have to enter in ABCLastName, FirstName. 

 

What I'm trying to do is to be able to return user data by only entering the LastName, FirstName. I figure it should be possible to query our AD for the user Last name and First name fields. Does anyone know how best to go about achieving this? I've spent a bit of time trying to find out a solution, but have so far been unable to do so.

 

Thanks in advance, everyone!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Pull User Information based on AD LastName, FirstName

Hi @Anonymous,

Do you create a custom form for your SP list using PowerApps?

The searchTerm property of the Office365Users.SearchUser() function is only applied to display name, given name, surname, mail, mail nickname and user principal name property of user profile. I suppose that your Office365Users.SearchUser() formula would filter Office 365 users based on display name or given name property (seaarchTerm applied to display name or given name).

More details about the Office365Users.SearchUser() function, please check the following article:

https://docs.microsoft.com/en-us/connectors/office365users/#search-for-users

I have made a test on my side, please take a try with the following workaround:3.JPG

Set the Default property of the TextInput control within the Email Address Data card to following (or set Default property of the Email Address Data card to following):

First(
Filter(Office365Users.SearchUser(),DataCardValue1.Text in DisplayName || DataCardValue1.Text in GivenName)
).Mail

On your side, it should be:

First(
Filter(Office365Users.SearchUser(),Name.Text in DisplayName || Name.Text in GivenName)
).Mail

Set the Default property of the TextInput control within the Job Title Data card to following (or set Default property of the Job Title Data card to following):

First(
   Filter(Office365Users.SearchUser(),DataCardValue1.Text in DisplayName || DataCardValue1.Text in GivenName)
).JobTitle

On your side, it should be:

First(
   Filter(Office365Users.SearchUser(),Name.Text in DisplayName || Name.Text in GivenName)
).JobTitle

Set the Default property of the TextInput control within the Department Data card to following (or set Default property of the Department Data card to following):

First(
   Filter(Office365Users.SearchUser(),DataCardValue1.Text in DisplayName || DataCardValue1.Text in GivenName)
).Department

On your side, it shoud be:

First(
   Filter(Office365Users.SearchUser(),Name.Text in DisplayName || Name.Text in GivenName)
).Department

The GIF screenshor as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Pull User Information based on AD LastName, FirstName

Hi @Anonymous,

Do you create a custom form for your SP list using PowerApps?

The searchTerm property of the Office365Users.SearchUser() function is only applied to display name, given name, surname, mail, mail nickname and user principal name property of user profile. I suppose that your Office365Users.SearchUser() formula would filter Office 365 users based on display name or given name property (seaarchTerm applied to display name or given name).

More details about the Office365Users.SearchUser() function, please check the following article:

https://docs.microsoft.com/en-us/connectors/office365users/#search-for-users

I have made a test on my side, please take a try with the following workaround:3.JPG

Set the Default property of the TextInput control within the Email Address Data card to following (or set Default property of the Email Address Data card to following):

First(
Filter(Office365Users.SearchUser(),DataCardValue1.Text in DisplayName || DataCardValue1.Text in GivenName)
).Mail

On your side, it should be:

First(
Filter(Office365Users.SearchUser(),Name.Text in DisplayName || Name.Text in GivenName)
).Mail

Set the Default property of the TextInput control within the Job Title Data card to following (or set Default property of the Job Title Data card to following):

First(
   Filter(Office365Users.SearchUser(),DataCardValue1.Text in DisplayName || DataCardValue1.Text in GivenName)
).JobTitle

On your side, it should be:

First(
   Filter(Office365Users.SearchUser(),Name.Text in DisplayName || Name.Text in GivenName)
).JobTitle

Set the Default property of the TextInput control within the Department Data card to following (or set Default property of the Department Data card to following):

First(
   Filter(Office365Users.SearchUser(),DataCardValue1.Text in DisplayName || DataCardValue1.Text in GivenName)
).Department

On your side, it shoud be:

First(
   Filter(Office365Users.SearchUser(),Name.Text in DisplayName || Name.Text in GivenName)
).Department

The GIF screenshor as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,742)