PowerAutomateで、Office 365 グループ宛ての新着メールをトリガーする場合はOffice 365 Groups Mailコネクターを使おう
Office 365 の Outlook の受信をもとに作業を自動化する場合、PowerAutomateのトリガーはOffice 365 Outlookコネクターを利用します。ただし、Office 365 グループ宛ての新着メールをトリガーする場合、このトリガーの「新しいメールが届いたとき(V3)」や「新しいメールが共有メールボックスに届いたとき(V2)」を使ってもトリガーすることができません。
Office 365グループ宛ての新着メールをトリガーしたい場合は、Office 365 Groups Mailコネクターを利用して、「When a new email arrives to a groupトリガー」を設定する必要があります。
![](https://karuakun.wordpress.com/wp-content/uploads/2020/10/image-1.png?w=642)
どのグループからのメールをフックするかを選択し、
![](https://karuakun.wordpress.com/wp-content/uploads/2020/10/image-2.png?w=642)
Get a thread postアクションで投稿を取得します。
![](https://karuakun.wordpress.com/wp-content/uploads/2020/10/image-3.png?w=632)
改めてGroup IDを選択し、Thread IDにトリガーのConversion thread IDとPost IDを設定するとこんな感じに2段階のループになります。
![](https://karuakun.wordpress.com/wp-content/uploads/2020/10/image-7.png?w=687)
このコネクターで取得できる値はここで説明されています。とりあえず今回欲しいのはこのあたりですね。
属性 | 概要 |
Email address of the user | 送信元メールアドレス |
Name of the user | 送信元名 |
Body content | 本文 |
本文はHTMLメールの場合、当たり前ですがHTMLが入ってきてしまうので、Content ConversionコネクタのHtml to textアクションでテキストに変換してあげます。
![](https://karuakun.wordpress.com/wp-content/uploads/2020/10/image-8.png?w=638)
メールの件名が欲しい場合は、Get a conversation threadアクションを使って、Conversation topic をComposeしてあげれば取得できます。
![](https://karuakun.wordpress.com/wp-content/uploads/2020/10/image-9.png?w=616)
参考
https://powerusers.microsoft.com/t5/Building-Flows/Flows-for-Office-365-Groups/m-p/144442
https://flow.microsoft.com/en-us/blog/use-our-new-office-365-groups-mail-connector/