LoginSignup
0
4

More than 3 years have passed since last update.

PowerAutomateでSharePointのユーザー列からUPN(ユーザープリンシパル)を取得

Last updated at Posted at 2021-01-25

覚え書きです。

状況

  • 例:タスクを管理するSharePointリストに「担当者」のようなユーザー列を作成し、PowerAutomateにて①リストへの登録をトリガー→②担当者のメンショントークン取得→③フローボットからTeamsチャネルへ投稿(担当者にメンション)といったフローを想定。
  • メンショントークンの取得にはUPNが必要ですが、組織によってはUPN=Emailではなく、Emailを設定しても動きません。 ※UPN=AzureAD/M365のログインID。 ※連絡用メールアドレスを企業ドメインのものに設定しているなど、M365のログインIDとOutlookメールアドレスが異なる場合です。

対応方法

ユーザー.Claimsから関数を使用してUPNを取り出します。
Claimsの例
i:0#.f|membership|************@********.onmicrosoft.com

①まずユーザーのClaims変数にユーザー.Claimsを変数にセット
②次に以下の関数でUPNを取り出し
|以降の文字を取り出す処理です。

UPN取り出し
substring(variables('ユーザーのClaims'),add(lastIndexOf(variables('ユーザーのClaims'),'|'),1))

image.png
数式バーが小さいと思ったら全てのPowerAutomate設定を表示→プレビュー機能を
Onに

0
4
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
0
4