Draft mail message for a selected item

I got an interesting question on the Power Users forum a while back about e-mail templates. In this article I am creating a flow which will post a draft Outlook 365 email with dynamic content of a selected SharePoint list item.

Original request

I want to start an email form a SharePoint list item, that is populated with details from the selected item, but the author of the email can complete the email, address the email and then send it when finished.

Start an email form a SharePoint list item

The approach

– Create a button in a SharePoint list which will trigger the flow
– Create a flow which asks for an e-mail input and use an http with a Graph API create message request (this will create a draft outlook message).

This action however does require a App registration in Azure AD and the correct permissions (Mail.ReadWrite):
Using Flow with Graph API by Lee Ford
User Post Messages

The setup

1. Add a for a selected item trigger action. Add an Email Input

forselecteditem_template

2. Add an HTTP action. Use the following URI field value. Notice the x-ms-user-id in the URI. This will make sure that the draft is created in the mailbox of the person who is triggering the flow.

3. For the body I am using this example. However, you can add other dynamic values to it if you want. The email of the input is used for the To: field of the draft e-mail. Below is the json I used in my example.

post_draftmessage

4. Add the button (formatting) to your SharePoint List. In this example my column is called SendMail. Don’t forget to add id of your flow. Below is the json I used in my example.

sendmail_formatting

Testing

1. Go the SharePoint list and click the SendMail button for an individual list item. This will trigger the flow from the SendMail button and show a input box where you can enter a recipient e-mail address. Click Send E-Mail.

example_emaildraft

2. A draft e-mail will be created in the drafts folder of the user who triggered the flow.

draftemailexample

Happy testing!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.