Sending an Email with Multiple Attachments from SharePoint List

Introduction

In this article, we will explore the process of sending an email with attachments using Power Automate, specifically focusing on scenarios where items with attachments are created in a SharePoint list, such as Project Details.

Project

Steps

Go to https://make.powerautomate.com/ and initiate the process by adding a trigger – “When an item is created”. Select the appropriate SharePoint Site and List. Ensure that the SharePoint list allows storing multiple attachments on its items.

Project Details

To retrieve all attachments added to the newly created list item, include the “Get attachments” action. Keep the Site name and List name consistent with the previous step. Direct the output “ID” from the trigger to the input ‘ID’ field.

Get attachments

Introduce an “Initialize Variable” action. Name the variable as varAttachments and set its type as Array.

initalize

Incorporate an “Apply to each loop” and select the “body” output from the “Get Attachments”.

Within the loop, add the “Get attachment content” action. Maintain the SP site name and list name.

  1. For the ID field, choose the ID output from the “When an item is created” trigger.
  2. For the file identifier field, select the Id output from the “Get Attachments” action.

Proceed by adding an Append to array variable action. In the Name field, select the array variable initialized earlier. In the Value field, insert the following code:

{
"Name":@{item()?['DisplayName']},
"ContentBytes":@{body('Get_attachment_content')}
}

Append to array variable

Outside the Apply to Each action, include a "Send an email" action. Populate the To, Subject, and Body fields with the desired values. In the attachment section, click on the "Switch to input entire array" icon, then select the array variable containing the appended content of files.

Output

Attachment

Conclusion

By following these simple steps, you can effortlessly automate the process of sending emails with multiple attachments using Power Automate. This streamlined approach enhances efficiency and productivity in managing SharePoint lists with attachments.

Enjoy learning and optimizing your Power Automate capabilities!


Similar Articles