Power Appsには、作成したアプリの情報を取得出来るPower Automate Management(Power Automate 管理)コネクタというコネクタがあります。
この記事では、
- ModifyFlowOwnersの構文
- フローの所有者を追加・削除する方法
を紹介します。
Power Automate 管理コネクタの追加方法
左側のデータタブから、データの追加→Power Automate Managementを選択します。

Power Automate 管理を選択します。一覧になければ接続の追加をクリックして接続を作成します。

Power Automate 管理が追加されます。

ModifyFlowOwners
構文
PowerAutomate管理.ListMyFlows(enviromentName, flowName, {put:table}, {delete:table).value
enviromentName:環境ID
flowName:フローID
putとdeleteのtable部分には以下のようなフォーマットでユーザーIDを設定します。

フローの所有者を追加・削除する方法
準備
環境IDの入力が必須なので、環境を選択させるコンボボックス(ComboboxCanvasEnviroments)で選択した環境IDを入力します。もちろん静的な環境IDの入力でもOKです。

ListFlowOwnersアクションやフローの詳細画面から、フローIDを取得できる状態にしておきます。

ユーザー選択のコンボボックス(ComboboxCanvasUser)、追加、削除ボタンを画面に追加します。

追加
追加ボタンのOnSelectプロパティに、以下の数式を設定します。
PowerAutomate管理.ModifyFlowOwners(
ComboboxCanvasEnviroments.Selected.name,
PowerAppsOneGridFlows.Selected.name,
{
put:
[
{
properties:
{
principal:
{
id:ComboboxCanvasUser.Selected.Id,
type:"User"
}
}
}
]
}
)
コンボボックスで選択したユーザーを追加することができました。

削除
追加ボタンのOnSelectプロパティに、以下の数式を設定します。
PowerAutomate管理.ModifyFlowOwners(
ComboboxCanvasEnviroments.Selected.name,
PowerAppsOneGridFlows.Selected.name,
{
delete:
[
{
properties:
{
principal:
{
id:PowerAppsOneGridOwners.Selected.properties.principal.id,
type:"User"
}
}
}
]
}
)
モダンテーブルで選択したユーザーを削除することができました。

コメント