Power Apps How to list Office365 Users Connector in a combobox and how to set default values

Note that I was asked how to display a list of Office365 Users Connector in a combo box and set a default value.

スポンサーリンク

Office 365 Users Connector

The “Office365 Users” connector can pull information about users set up in AzureAD and Microsoft365 Center.

In this article, we will show how to display the list of users retrieved by this “Office365 Users” connector in a combo box.

When using the SearchUser function

First, here is the formula to list users using SearchUser function.

Office365Users.SearchUser()

In addition, if you want to set a default value for a combo box,
If you put the SearchUser function in the “DefaultSelectedItems” property of the combo box as well, and put the email of the user you want to default to the “searchTerm” argument, you can specify the user to be selected in the combo box.

When using the SearchUserV2 function

Here is the next expression that displays the list of users using the SerachUserV2 function.

Office365Users.SearchUserV2({isSearchTermRequired:false}).value

Unlike SearchUser, it is necessary to set isSearchTermRquired to false and add “.value”.

Then, when you want to give the combo box displaying the SerachUserV2 function a default value, put in the SearchUserV2 function with “searchTerm” in the DefaultSelectedItems property, just like the SearchUser function, and the specified user will be selected.
By the way, you can put the SearchUser function in the “DefaultSelectedItems” property instead of SerachUserV2 to set the default value, though,
MyProfileV2 function cannot do this.

Extra: About Search

When both SearchUser and SearchUserV2 are displayed in the combo box, the search seems to work without setting Self.SearchText in “searchTerm”.
If you want to search not only by email but also by display name or something,
You can expand the search by putting the columns you want to search in the combo box SearchFields.

コメント

タイトルとURLをコピーしました