Power Apps Combo Box Search Office365Users

Recently, I got a requirement for a client to display the Office365Users name in the Power Apps Combo box control. Now, let us check how to achieve this!

In this Power Apps tutorial, I will explain the “Power Apps Combo box search Office365Users.”

Moreover, you will learn how to exclude guest users from the Power Apps combo box connected with Office365Users, and we will also learn to filter the Power Apps combo box with Office365Users.

Power Apps Combo box with Office 365 Users

This section will show you how to connect the Power Apps Combo box control with Office 365 users.

Example,

I created a Power Apps Canvas app and added a Combo box control connected to Office365Users.

Whenever the user expands the combo box control, it displays the list of Office365 users as shown below:

Using Power Apps combo box to search office 365 users

To achieve it, follow the below steps:

  • Sign in to your Power Apps with your valid Microsoft 365 credentials.
  • Create a Power Apps Blank canvas app -> Connect the data source as Office365Users as shown below:
Power Apps Combo box search office 365 users
  • On the Power Apps screen, insert a Combo box control -> Set its Items property to:
Office365Users.SearchUser({searchTerm: cmb_Office365Users.SearchText})
Power Apps combo box to search office 365 users
  • SavePublish, and Preview the app. Now, the combo box control contains the users from Office 365.
How to build People Picker in Power Apps with Office 365 Users Search

If you need to display a department with their name. Follow the below steps:

Show display name and department in a Power Apps combo box control

I will show you how to display the name and their department in the Power Apps combo box control.

  • Select the Combo box control -> On the combo box properties pane, click on Edit fields
People Picker in Power Apps with Office 365 Users Search
  • Select the layout as Person -> Then choose Primary text as “Display Name” and Secondary text as “Department” as shown below:
Power Apps combo box with Office 365 Users search
  • SavePublish, and Preview the app. When the user expands the combo box control, it displays the user’s name with their department.
How to set Power Apps combo box with Office 365 Users Search

The Power Apps combo box will display the guest users, as mentioned in the screenshot below.

Power Apps combo box Office 365 users allow search

To avoid the guest user in the Power Apps combo box control, follow the below steps:

Exclude guest users from the Power Apps combo box with Office365Users

Let me check how to avoid displaying the guest users in the Power Apps combo box control.

Example,

On my Power Apps screen, a Combo box control is connected to an Office365Users.

Whenever the user expands the combo box control, it will display the user name by avoiding the guest user’s name.

Exclude guest users from the Power Apps combo box with Office365Users

To achieve it, follow the below steps:

  • Select the Combo control -> Set its Items property to:
Filter(
    Office365Users.SearchUser({searchTerm: cmb_Office365Users.SearchText}),
    AccountEnabled = true && Not("#EXT#" in UserPrincipalName)
)
How to exclude guest users from the Power Apps combo box with Office365Users
  • SavePublish, and Preview the app. Now, the Power Apps combo box control contains the users from Office 365 by avoiding the guest users.
Exclude guest users from the combo box with Office365Users in Power Apps

This is how we can exclude the guest users from the Power Apps combo box with Office365Users.

Power Apps Office365Users filter by department

I will show you how to filter the Power Apps combo box control connected to Office 365 users by their department.

Example,

I created a Power Apps Canvas app and added a Combo box control connected to Office365Users.

Next, Whenever the user expands the combo box control, it displays the users who all are in the “Marketing” team, as in the screenshot below:

Power Apps Combo box office 365 users filter

To achieve it, follow the below steps:

  • On the Power Apps screen, insert Combo box control -> Set its Items property to:
Filter(
    Office365Users.SearchUser(
        {
            searchTerm: cmb_UserFilter.SearchText,
            top: 0
        }
    ),
    Department = "Marketing"
)

Where,

  1. cmb_UserFilter = Combo box control name
Filter Power Apps Combo box office 365 users
  • SavePublish, and Preview the app. Now, the combo box control contains the users from only the marketing team.
Power Apps Combo box with office 365 users filter

This is how to filter the Power Apps combo box control with Office365Users.

Conclusion

I trust this Power Apps tutorial helped you to connect the Power Apps Combo box control with Office 365 users.

Lastly, through our tutorial, you have learned to exclude guest users from the Power Apps combo box connected with Office365Users and how to filter the Power Apps combo box with Office365Users by their departments.

You may also like: