cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cjordan
Level: Power Up

Searching AND Selecting Office 365 Users

I am currently working on a "Create Ticket" form for our ticketing system. I currently am able to search for users in our Office 365 tenant by using: Office365Users.SearchUser({searchTerm: inputTo.Text})

 

The problem I am having, is that I want the user to then be able to "Select" the name and have it autofill the name column.

 

Do you know if this is possible?

Any guidance is appreciated.

 

Thanks!

6 REPLIES 6
PowerApps Staff rgruian
PowerApps Staff

Re: Searching AND Selecting Office 365 Users

It should be possible to pipe the result of that query into e.g. a listbox or a gallery -- customized to render whetever fields you want to show -- which will allow for that selection process to occur. Once an item/user is selected, the selection becomes available at the "Selected" property of the lisbox or gallery, allowing you to use it in other formulas. For example:

 

    NameInput.Default = listbox.Selected.Name

 

I would be happy to help in more detail if I had a bit more context into what you are trying to accomplish.

Radu Gruian [MSFT] ** PowerApps Staff
PowerApps Staff sarafankit
PowerApps Staff

Re: Searching AND Selecting Office 365 Users

What control are you using to show the users returned from the search? If you are using a Gallery control, you will be able to refer tthe record user has clicked/selected using the Gallery.Selected property.

cjordan
Level: Power Up

Re: Searching AND Selecting Office 365 Users

 

Thank you very much for your response!

 

Do you have any information on how to set something like this up?

 

I have looked throught the PowerApps forums  and documentation but have not been able to come to anything helpful Smiley Sad

 

 

PowerApps Staff rgruian
PowerApps Staff

Re: Searching AND Selecting Office 365 Users

- Create a Gallery
- Within the gallery, create for example a label to show the user name
- Bind the gallery to the results coming from Office365
    gallery1.Items = Office365Users.SearchUser({searchTerm: inputTo.Text})

- This will auto-bind the label to the Name field. Please feel free to re-bind it to any other field, such as Email.

- Outside of the gallery, create a text input control that will be "auto-filled" with the selected user

- Bind the input to the gallery selection, e.g. the name field.

    inputText2.Default = gallery1.Selected.Name

 

I hope this helps.

Radu Gruian [MSFT] ** PowerApps Staff
PowerApps Staff sarafankit
PowerApps Staff

Re: Searching AND Selecting Office 365 Users

Assuming you have put a TextInput control to enter the name for search and a gallery to your screen.

 

The Items property of gallery should be set to: Office365Users.SearchUser({searchTerm:TextInput1.Text})

 

And then add a TextBox where you want to show the name of the selected user, and set its Text property to Gallery1.Selected.DisplayName

esoPowerUser
Level: Powered On

Re: Searching AND Selecting Office 365 Users

Thanks for info MSFTSs Ankit Saraf and Radu Gruian. Would like to mention that in addition to the selected value it also seems possible to use the LookUp function which perhaps may be useful in some scenarios to avoid naming collitions where you are displaying/ filtering SharePoint List Items with People Columns in Content Controls, and want to show user details for multiple users at the same time.

 

LookUp( Office365UsersGallery.AllItems, DisplayName = "[Display Name]").Department


Where the Office365UsersGallery Item Property is set as Radu Gruian/ Ankit Saraf explained to us:


Office365Users.SearchUser({searchTerm:TextInput1.Text})

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 186 members 4,029 guests
Please welcome our newest community members: