cancel
Showing results for 
Search instead for 
Did you mean: 
Diksha

Share Multiple Attachments of SharePoint List via Email using Power Automate

I have written an article here on how to share multiple attachments via Email using Power Automate.

Let us have a look at a detailed steps to implement this .


Step 1 – Create the blank Microsoft Flow

  • Go to flow.microsoft.com, sign in with your work or school account, click on My flows menu in the left navigation bar, and then click on ‘+New’ and Select Instant – from blank.
     

    capture1-3.png

  • Click on the Skip option given below and then give the flow name at top left in next screen.
     

    capture2-1.png

Step 2 – Select a Trigger point of the Flow

  • Search for the appropriate trigger when you want the flow to initiate. 
  • Here, we will select the trigger as ‘When an item is created’ which means that the flow will run whenever a new item is created in selected SharePoint list.
     

    capture4.png

  • Select the Site Address and List name where an item will be added along with the attachments.
     

    capture5.png

Step 3 – Initialize Variable and Get List Attachments

  • Click on +New Step and Choose an action ‘Initialize Variable’.
  • Give the variable name say ‘AttachmentArray’ of type Array which we will use to create an array of all the attachments of newly created item.
     

    capture6.png

  • Now, add another action ‘Get attachments’ and select the Site Address and List name .
  • Set the Id to ID of When an item is created trigger from the Dynamic content which appears in right as shown below.
     

    getattachments-1.png

Step 4 – Read Attachments Content and Create an Array

  • Add an action ‘Get attachment content’ and select the Site Address and List name .
  • Set the Id to ID of When an item is created trigger from the Dynamic content which appears in right.
  • Set File Identifier to Id of Get attachments from the Dynamic content as shown below.
  • As soon as you set the File Identifier , an Apply to each loop will be added automatically in order to get the attachment content of each file.
     

    attachmentcontent-1.png

  • Add ‘Append to array variable’ action after Get attachment action and within the Apply to each loop.
  • Select the variable ‘AttachmentArray’ as Name which we have created at the beginning of the flow.
  • Set the Value to the following JSON  where 
    Name –  will be the DisplayName of Get attachments
    ContentBytes – will be the Attachment content of Get attachment content.
     

    appendtoarrayvar-1.png

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

Step 5 – Send attachments via Email

  • Finally, add an action ‘Send an email (V2)’.
  • Set the values of To, CC and BCC to whom you have to send an email and add Subject, Body .
  • Set the From(Send as) value to the Email address to send mail from if needed else the mail will be sent from the person whose connection is set in the flow.
  • Set the value of Attachments to AttachmentArray variable.
  • Set the Importance to Low, Normal or High if needed.
     

    sendemail-1.png

That’s all, the flow is ready in few simple steps.

 

flow (1).png


Now, let us check how the flow will work .


Add a new item in the SharePoint list along with the multiple attachments .
I have created an item and added 2 attachments with it .


An Email is received having the attachments as shown below –

output.PNG

Comments

Hi @Diksha interesting article just wondering how I would add attachments from a Microsoft form submission to an approval email? Or am I best building 2 flows one to add the data to a list and then another to email off the attachments in an approval flow? 

 

Many Thanks

Thank you for clean layout! @Diksha 

 

I am able to do this successfully with a Send an Email (V2) connector. However, I get an error with the same array variable using the Create an approval connector.

 

Error Details:

The request content was invalid and could not be deserialized: 'Could not find member 'ContentBytes' on object of type 'ApprovalsConnectorAttachment'. Path 'attachments[0].ContentBytes', line 1, position 333.'.

 

Output Error Details:

"code""InvalidRequestContent",
"message""The request content was invalid and could not be deserialized: 'Could not find member 'ContentBytes' on object of type 'ApprovalsConnectorAttachment'. Path 'attachments[0].ContentBytes', line 1, position 333.'."
 
Anonymous

Hello,

 

I am doing the exact same thing but my flow does not work

 

The Send an Email V2 part has this error

Marielva_0-1669844434495.png

 

 

Can you help me to solve this?

 

The AttachmentsArray does not appear as an option for me in the dynamic content for sending an email - please help!

This article originated a while ago but does address my question, so I'm hoping someone sees this and can help.

 

I've created a flow in power automate that is supposed to send an email with attachments whenever a new item is added to the list using power apps.

 

My flow fails at this point:

 

SMiller3_0-1687986268874.png

SMiller3_1-1687986322503.png

 

And the error details:

SMiller3_2-1687986402055.png

 

I have tested this flow many times.  Everything works except when I try to set up for attachments.  

 

Any help  or hints would be greatly appreciated.

 

TYIA

 

To make the email action work outside the apply to each using the variable array you have to click the small square button next to 'Attachments' in the mail action. Then it switches so you can input the array variable.

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/