11
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Power Automate でメール本文に画像を埋め込む

Last updated at Posted at 2023-05-29

はじめに

ある程度フォーマットが決まったメールを送る業務を Power Automate で自動化するようなシナリオがあります。

アプローチ方法としては、例えば、SharePoint リストに予めメールのテンプレートを用意しておき、一定の周期で自動でフローを動かしてメールを送る、または、Power Apps でそのリストを読み込み、何かしらの選択をして、ボタンを押したらそのテンプレートのメールが送られるみたいなものがあります。

その際、メールの本文に画像を埋め込みたいという要件をいただくことがあるため、今回、そちらのアプローチについて説明いたします。

SharePoint ドキュメントライブラリの準備

今回、画像ファイルはドキュメントライブラリに保存しておきます。

image.png

※出来れば、SharePoint リストの画像列で実現したいですが (画像列の値がリンクになれば実現できるはず)、一旦は、Power Automate からリンクの扱いが容易なドキュメントライブラリでの実現方法を紹介します

Power Automate の処理

Power Automate は非常にシンプルで、以下のようなイメージです。

image.png

ドキュメントライブラリからファイルのプロパティを取得し、img タグを使ってアイテムへのリンクをソースにします。

<img src="@{items('Apply_to_each')?['{Link}']}"> 

image.png

無事に画像付きメールが届きました。

image.png

SharePoint 上に画像ファイルがあるため、受信者はこちらのファイルにアクセスできる必要があります。そのため、SharePoint のアクセス権を、受信者を想定して適切に設定する必要があります。基本的には、社内受信者限定のアプローチと考えます。

まとめ

Power Automate でメール本文に画像を埋め込む方法について紹介しました。メール本文に画像を埋め込みたいというニーズは結構あると思うので、参考にしていただければ幸いです。

11
4
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?