1
1

【Power Apps】SharePointリストのユーザ型にOffice 365 Usersから取得したユーザを格納する際の注意点

Posted at

はじめに

Power Appsに用意されているデーターソースの内、テナント内のユーザー情報を取得できるデータソース「Office 365 Users」があります。このデータからユーザーを検索してSPリストのユーザ型列にデータを入れたい!となったとき、新規登録なら問題ありませんが更新する際は以下のような工夫が必要です。

image-2.png

対処法

編集フォームのユーザ型カードのUpdate部に以下のようなコードを入れることで、Office 365 Usersから指定した値があればOffice 365 UsersのデータをSPリストのユーザ型に変換したデータを、なければ元のデータ(フォームに表示されているSPリストのユーザ型データ)を指定するコードです。
※冗長になるので、選択した365ユーザをWith句で変数化してます。

If(
  IsBlank(cmbO365Users.Selected.Mail),
  ThisItem.User,
  With(
    {_user365: cmbO365Users.Selected},
    {
        Claims: "i:0#.f|membership|" & Lower(_user365.Mail),
        Department: "",
        DisplayName: _user365.DisplayName,
        Email: _user365.Mail,
        JobTitle: ".",
        Picture: "."
    }
  )
)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1