cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UnitedLexAdmin
Level: Powered On

Default user for Office365Users.SearchUser search

In my app I'm searching for users within my org based on text from a label in my app. If there is no text in label it defaults to a user and I want to be able to control which user it defaults to.

 

Office365Users.SearchUser({searchTerm:SMEHiddenKey.Text, top:1})

 

SMEHiddenKey is the label that is being searched.

 

Any thoughts on how to change the default?

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Default user for Office365Users.SearchUser search

Hi @UnitedLexAdmin ,

 

Use If(!IsBlank(SMEHiddenKey.Text),Office365Users.SearchUser({searchTerm:SMEHiddenKey.Text,top:1})) as Items Property for your gallery

 

 

Regards,

Reza Dorrani

 

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

6 REPLIES 6
Highlighted
Dual Super User
Dual Super User

Re: Default user for Office365Users.SearchUser search

Hi @UnitedLexAdmin 

 

Add an if statement to check if the label is blank, if yes do not query search users

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

UnitedLexAdmin
Level: Powered On

Re: Default user for Office365Users.SearchUser search

Thanks, @RezaDorrani .

 

I'm fairly new to this and I'm having a hard time creating the statement. This is what I got so far:

 

If(IsBlank(SMEHiddenKey), Office365Users.SearchUser({searchTerm:SMEHiddenKey.Text, top:1}))

This is throwing all sorts of errors, so I'm sure I'm messing something up.

 

Dual Super User
Dual Super User

Re: Default user for Office365Users.SearchUser search

@UnitedLexAdmin 

 

Do not worry, PowerApps is fun and easy

 

Assuming you are using this formula on the Text property of a Label control, then the below should work

 

If(IsBlank(SMEHiddenKey.Text),"",First(Office365Users.SearchUser({searchTerm:SMEHiddenKey.Text,top:1})).DisplayName)

 

If you are using this formula on some other control property, please let me know

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

UnitedLexAdmin
Level: Powered On

Re: Default user for Office365Users.SearchUser search

@RezaDorrani  Thanks for helping out. I'm using this in a gallery under the Items property. I tried your formula and there is an error.

 

Thanks!

Dual Super User
Dual Super User

Re: Default user for Office365Users.SearchUser search

Hi @UnitedLexAdmin ,

 

Use If(!IsBlank(SMEHiddenKey.Text),Office365Users.SearchUser({searchTerm:SMEHiddenKey.Text,top:1})) as Items Property for your gallery

 

 

Regards,

Reza Dorrani

 

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

chico
Level: Powered On

Re: Default user for Office365Users.SearchUser search

thank you, 

this little hint just gave me a good boost in my own little project!

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 (7,620)