cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Start an email form a SharePoint list item, that is populated with details from the selected item without sending it.

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @Anonymous,

 

I would say this is possible by using the following 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):

https://www.lee-ford.co.uk/using-flow-with-graph-api/
https://docs.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0

 

Below is an example of such an setup.

 

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

forselecteditem_template.png

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.

https://graph.microsoft.com/v1.0/users/@{triggerOutputs()['headers']['x-ms-user-id']}/messages

 

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.

{
    "subject":"E-mail template flow",
    "importance":"Low",
    "body":{
        "contentType":"HTML",
        "content":"They were <b>awesome</b>!"
    },
    "toRecipients":[
        {
            "emailAddress":{
                "address":"@{triggerBody()['email']}"
            }
        }
    ]
}

 

post_draftmessage.png

 

3. 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.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\":\"yourflowid\", \"headerText\":\"Example E-mail Template\",\"runFlowButtonText\":\"Send E-mail\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover",
    "title": "Launch Flow"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "Mail"
      }
    }
  ]
}

 

sendmail_formatting.png

 

The end result should look something like this

 

1. Trigger flow from the SendMail button

example_emaildraft.png

 

2. Draft e-mail in the Drafts folder of the user who triggered the flow.

draftemailexample.png

 

Hope this helps to get you started?

View solution in original post

1 REPLY 1
Expiscornovus
Dual Super User
Dual Super User

Hi @Anonymous,

 

I would say this is possible by using the following 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):

https://www.lee-ford.co.uk/using-flow-with-graph-api/
https://docs.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0

 

Below is an example of such an setup.

 

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

forselecteditem_template.png

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.

https://graph.microsoft.com/v1.0/users/@{triggerOutputs()['headers']['x-ms-user-id']}/messages

 

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.

{
    "subject":"E-mail template flow",
    "importance":"Low",
    "body":{
        "contentType":"HTML",
        "content":"They were <b>awesome</b>!"
    },
    "toRecipients":[
        {
            "emailAddress":{
                "address":"@{triggerBody()['email']}"
            }
        }
    ]
}

 

post_draftmessage.png

 

3. 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.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\":\"yourflowid\", \"headerText\":\"Example E-mail Template\",\"runFlowButtonText\":\"Send E-mail\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover",
    "title": "Launch Flow"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "Mail"
      }
    }
  ]
}

 

sendmail_formatting.png

 

The end result should look something like this

 

1. Trigger flow from the SendMail button

example_emaildraft.png

 

2. Draft e-mail in the Drafts folder of the user who triggered the flow.

draftemailexample.png

 

Hope this helps to get you started?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,595)