Power Automate Send Email With Attachment [From SharePoint List]

Recently, I have been working on Power Automate, where I received a task to send email with attachment using Power Automate [from SharePoint list and Document library].

In this Power Automate tutorial, I will explain all about Power Automate send email with attachment from SharePoint list, Power Automate send an email with attachment when file is created.

Also, we will see how to work with Power Automate send email with attachment from SharePoint library with various examples.

Power Automate Send Email with Attachment from SharePoint List

To add an attachment to an email from the SharePoint list using Power Automate, follow the below-given steps:

Scenario:

To do this, I will use a SharePoint list with a few columns, as you can see from the below image:

Power Automate send email with attachment

Whenever an item is created in the SharePoint list [Products], an Invoice attachment of the product will be sent to a person who is inspecting the quality of the product.

Check out the below steps:

1. Navigate to the Power Automate Home page, click + Create, select the Automated cloud flow, provide the flow name, choose the flow trigger (When an item is created), and click the Create button.

Provide the Site Address and List Name inside the trigger.

Power Automate send email with attachment from SharePoint

2. Take Initialize variable flow action, set a Name for a variable, and select the Type as Array.

Power Automate send email with attachment from SharePoint list

3. Next, add the ‘Get attachments‘ flow action and provide the below parameters:

  • Site Address: Select a specific SharePoint site from drop-down.
  • List Name: Choose a particular list.
  • Id: Select Id from dynamic content under When an item is created.
Power Automate attach file to email

4. After that, take the Get attachment content flow action to retrieve the details from the attachment. Configure the properties like Site Address, List Name, and Id.

  • File Identifier: Take Id from the dynamic content of Get attachments.
See also  Review of Collabion Charts for SharePoint: A 100% code-free product for all business users

For each loop will be added automatically, taking Body outputs from Get attachments.

Send email with attachment from SharePoint Power Automate

5. Then, add Append to array variable inside the loop, and set the below details:

  • Name: Select the name from the drop-down.
  • Value: Insert the below given code.
{
  "Name": "@{items('For_each')?['DisplayName']}",
  "ContentBytes": "@{body('Get_attachment_content')}"
}
Power Automate send email with attachment when item is created

6. Finally, add Send an email(v2) flow action outside of the loop. Set the required parameters:

  • To: Select Quality Inspected By Email, separated by a semicolon.
  • Subject: Provide a subject line for a mail.
  • Body: Provide a detailed description of a mail.

Then, click Show all to display the advanced parameters.

  • Attachments: Add attachments variable from dynamic content.
How to add attachment in Power Automate email

7. Now, it’s time to save the flow. Click on Test -> Select Manually. At this step, add an item to the SharePoint list with an attachment.

Add attachment to email Power Automate

8. When the flow runs successfully, it will send an email notification to the provided user with an attachment, as shown in the screenshot below.

Power Automate add attachment to email from SharePoint list

This way, we can get attachments from the SharePoint list and send emails using Power Automate.

Power Automate Send Email with Attachment When file is Created

To add an attachment to an email, when a file is created in the SharePoint document library in Power Automate, follow the below steps:

Requirement:

When a new file is created in the SharePoint document library[Course Documents], send an email attachment to the Course Manager.

1. Add ‘When a file is created(properties only)‘, select Site Address and Library Name.

Power Automate send email with attachment when file is created

2. Next, take the Get file content flow action and set the required parameters:

  • Site Address: Select SharePoint from the options listed in the drop-down menu.
  • File Identifier: Take the Identifier from the dynamic content.
Send SharePoint file as email attachment Power Automate

3. Now, add Send an email(v2) action, set the below details like:

  • To: Take Course Manager email from dynamic content.
  • Subject: Provide a subject line for an email.
  • Body: Add a detailed description for the email.
See also  How to handle radio button checked and unchecked events using JavaScript and jQuery

Click Show all to display the advanced parameters.

  • Attachments: Provide a name for the attachment and select Body from the file content.
    • Name: Enter a name for an attachment with .pdf.
    • Content: Select File content from Get file content of dynamic content.
Power Automate attach SharePoint file to email

Then, save and test the flow.

4. Now, create a file in the SharePoint document library as shown in the image below:

Power Automate attach SharePoint document library  file to email

Output:

The Course Manager will receive an email with an attachment in Outlook.

Send file from SharePoint via email Power Automate

This is how to send files from SharePoint via email Power Automate.

Power Automate Send Email with Attachment from SharePoint Document Library

To send an email with multiple attachments from a SharePoint document library folder, check the below-mentioned steps:

Scenario:

I have taken a SharePoint document library, which consists of folders and files as look like below:

Power Automate send an email with attachment when file is created

My requirement is to send the files present inside the folder as attachments in the email.

Go through the steps:

1. Navigate to the Power Automate Home page, click + Create -> select the Instant cloud flow -> provide the flow name -> choose the flow trigger (Manually trigger a flow) -> click the Create button.

2. Next, take ‘Get files(properties Only)‘ flow action. Provide required parameters:

  • Site Address: Choose a specific site address from the drop-down menu.
  • Library Name: Select a library name under the SharePoint site.

Click on Show all to display all the Advanced parameters.

  • Limit Entries to Folder: Select the Folder path from the open Folder icon.
Power Automate send email with attachment from SharePoint document library

3. Take Initialize variable flow action, set a Name for a variable, and select the Type as Array.

Power Automate send SharePoint file as attachment

4. After that, add the Get file content flow action and set the details like Site Address and File Identifier -> Select Identifier from dynamic content

See also  SharePoint Rest API Tutorial and Examples

Then, For each loop will be added, taking the body/value from the Get file properties.

Power Automate send SharePoint document file as attachment

5. Then, add Append to array variable inside the loop, and set the below details:

  • Name: Select the name from the drop-down.
  • Value: Insert the below given code.
{
  "Name": @{items('For_each_1')?['{FilenameWithExtension}']},
  "ContentBytes": @{body('Get_file_content')}
}
Power Automate attach SharePoint document files to email

6. Outside of the loop, add Send an email(v2) flow action, fill the below parameters.

  • To: Take Course Manager email from dynamic content.
  • Subject: Provide a subject line for an email.
  • Body: Add a detailed description for the email.

Click Show all to display the advanced parameters.

  • Attachments: Click on the Switch to input an array item icon -> Click Array variable from dynamic content.
How to add multiple attachments in Power Automate email

7. Once the flow is ready, save and run the flow manually.

Output:

The user will receive an email with multiple attachments from the SharePoint document library.

Refer to the image below!

Send email with multiple attachments from SharePoint library Power Automate

This is how to send email with multiple attachments from the SharePoint document library folder using Power Automate.

Also, you may like:

Conclusion

I trust this Power Automate tutorial gave you an idea of how to send an email with an attachment from a SharePoint list.

Additionally, we saw how to send emails with attachments when the file is created and multiple attachments from a SharePoint document library using Power Automate.

  • Is there a way to use “Send an email notification (V3)” ? This would be preferable as the automated emails do not come from my email account.

  • Hi, So I have a reminder flow that loops through a list and gets the reminder date which then sends a mail. How do I send singular attachment from a single row in the list since I used a “get items” action rather than “get item”, “get items” tend to loop and fetch all attachments from the list and send in the emails that come. I’m trying to send an attachment per row and not all the attachments within all the lists.

  • For the folks seeing issues using the attachments in approval workflows, use the following while constructing the arrary

    {
    “content”: {
    “$content-type”: “@{body(‘Get_attachment_content’)[‘$content-type’]}”,
    “$content”: “@{body(‘Get_attachment_content’)[‘$content’]}”
    },
    “Name”: “@{items(‘Build_Attachment_array’)?[‘DisplayName’]}”
    }

    Reference: https://powerusers.microsoft.com/t5/Building-Flows/The-request-content-was-invalid-and-could-not-be-deserialized/td-p/737581

  • I used the same logic to attach documents from OneDrive, but instead of single email the emails being sent is directly proportional to the number of attachments. Can someone help me here?

  • >