cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Community Support

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
Community Support

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,905)