0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Power Apps と Power Automate を使用して、他人の予定表にイベントを追加する

Last updated at Posted at 2025-01-31

はじめに

ごきげんよう、百合宮桜です。
今回は Power Apps と Power Automate を利用して、他の人の予定表にイベントを追加する方法を紹介いたします。

他人の予定表にイベントを追加する方法について

基本的にPower Automate の標準的な権限で「他人の Outlook 予定表にイベントを追加する」ことはできません。

これを可能にするには
①フローの実行者=予定表所持者本人にする(インスタントクラウドフローを利用する)
②GraphAPI のアクセス権限を所持したアカウントで自動化フローやスケジュール済クラウドフローのいずれかを実行する

のどちらかになります。
②は市民開発者が開発するには色々とムズカシイところがございますので、①の方法を紹介します。

Power Automate 側の処理

トリガーの設定

  1. Power Apps がフローを呼び出したとき(V2)トリガーを指定して、フローを作成します

    image.png

  2. トリガーにテキストの入力を追加します
    image.png

    image.png

  3. 入力の名前を「CalendarID」に変更します

    image.png

    ※名前は何でもよいですが、この値が何か分かるようにしてください

イベントの作成アクションの設定

  1. イベントの作成アクションを追加します

    image.png

  2. 予定表ID で「カスタム値を入力する」を選択します

    image.png

  3. 動的なコンテンツからトリガーで設定した「CalendarID」を指定します

    image.png

    このCalendarID は Power Apps 側で取得し、それをPower Automate に受け渡します。

    :

  4. 必須項目(件名・開始時刻・終了時刻・タイムゾーン)を入れます

    image.png

  5. フローを保存します

Power Apps 側の処理

データソースの設定

データの追加から Office 365 Outlook コネクタを追加します。

image.png

予定表ID の取得

アプリにボタンを追加し、そのボタンの OnSelect プロパティ中に以下の式を入力します。

//グローバル変数を設定
Set(_gblMyCalendar,

    予定表ID を取得
    LookUp(
        //自分が所持しているカレンダー一覧を取得
        Office365Outlook.CalendarGetTablesV2().value,

        //name が予定表 or Calendar のものを探す
        name="予定表"Or name="Calendar"
    ).id
)

これでアプリユーザーがボタンを押下した時に予定表ID を取得することができます。取得した予定表IDは変数「_gblMyCalendar」に格納されます。

Power Automate フローの実行

Power Apps のアプリ側から Power Automate のフローを実行する処理を書きます。

  1. ・・・ > Power Automate > フローの追加 をクリックします

    image.png

  2. 先ほど作成したフローを追加します

    image.png

  3. ボタンの OnSelect プロパティの中に以下の処理を追加します

    PowerAppsからイベント作成を実行.Run(_gblMyCalendar)
    

    image.png

これでボタンを押した人の予定表にイベントが追加できます。

image.png

終わりに

いかがでしたか?
予定表ID をカスタム値で設定するのは意外と気づきにくく、お客様からもかなり質問が多いです。
Microsoft 365 のライセンス範囲内で実行できますので、ぜひ試してみてくださいね!

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?