Office365ユーザーコネクタの一覧をコンボボックスに表示して、既定値を設定する方法を質問されたのでメモ。
Office365ユーザーコネクタ
Entra IDやMicrosoft365センターで設定したユーザーの情報を引っ張ってこれるのが「Office365ユーザー」コネクタ。
どこでどんな値を設定できるかは過去の記事で。



Power Automate Power Apps Office365ユーザーコネクタで取得できる情報の設定場所一覧
Office365ユーザーコネクタで取得できる情報(表示名、趣味、上司など)を「設定する場所」を調査したので、その内容をメモ。Office365ユーザーコネクタOffice365コネクタはOffice365アカウントを使用して、組織のユーザ...

Power Automate Power Apps Office365ユーザーコネクタで取得できる情報の設定場所詳細
前回の記事でOffice365ユーザーコネクタ(以下O365コネクタ)で取得できる情報の設定場所一覧を紹介したので、今回の記事ではその設定場所へのたどり着き方をご紹介。前回紹介した設定場所はこちら OfficeDelve SharePoin...
今回はこの「Office365ユーザー」コネクタで取得したユーザーの一覧をコンボボックスに表示する方法について紹介。
SearchUserを使用する場合
まずSearchUserを使ってユーザーの一覧を表示する式はこちら。
Office365ユーザー.SearchUser()
さらにコンボボックスに既定値(今回はログインユーザーのわんさん)を設定したいときは、


コンボボックスの「DefaultSelectedItems」プロパティにもSearchUser関数を入れてあげて、引数の「searchTerm」に「既定値にしたいユーザー」のメールを入れてあげると、コンボボックスに対して選択されるユーザーを指定することができる。


SearchUserV2を使用する場合
続いてSerachUserV2を使ってユーザーの一覧を表示する式はこちら。
Office365ユーザー.SearchUserV2({isSearchTermRequired:false}).value
SearchUserと違ってisSearchTermRquiredにfalseを設定して「.value」を付けてあげる必要がある。
で、SerachUserV2を表示しているコンボボックスに既定値を設定してあげるときは、SearchUserと同様にDefaultSelectedItemsプロパティに「searchTerm」を指定したSearchUserV2関数を入れてあげれば、指定したユーザーが選択される。


ちなみにSerachUserV2の代わりに「DefaultSelectedItems」プロパティにSearchUser関数を入れても既定値の設定ができるけど、


MyProfileV2関数だとだめ。


おまけ:検索について
SearchUserもSearchUserV2もコンボボックスに表示するときは「searchTerm」にSelf.SearchTextを設定してあげなくても、検索はうごくっぽい。


もしメールだけでなく表示名とかからも検索したい場合は、


コンボボックスのSearchFieldsに検索したい列を入れると、検索対象を広げることができる。


コメント