Introduction
In this article, we will learn how we can get multiple documents from the SharePoint document library and send them in attachments in the mail using Power Automate.
Scenario
In this article, I have one list with the name Sendmail, in which there is a column where I will specify comma-separated document IDs which I want to send in the mail.
Furthermore, in the list, I have other columns like MailToAddress, Email Subject, and Email Body.
I need to send a mail with attachments when items created in this list.
Setup MS Flow
Step 1
Create an automated flow and select the 'when an item is created' template.
Step 2
Select site and Sendmail list.

Step 3
Now add a new action for initializing the variable. Give a variable name and select type as a string. In value, select the DocumentsIDs column from the list which will have comma-separated ids of documents that you want to send in the mail.

Step 4
Again, add initialize variable action. Give the variable name and select type as array. Keep value blank.

Step 5
Now, we will use Apply to each action which will loop through all documents ids and get documents. So, add apply to each action and we will split with comma our variable which we used for store document ids.
Step 6
In the Select an output from previous steps textbox, add below line in Expression and click on OK button, as shown in below screenshot.
- split(variables('DocumentIDs'),',')

Step 7
Now in Apply to each, add Get file properties action. Select site URL and document library in which all your documents placed which will be sent in an email And in the ID field, select the below expression:
- items('Apply_to_each')

Step 8
Now add a Get file content action. Select Site Address and in the File Identifier field, select the identifier returned by the Get file properties action.












Rupesh MalewadkarPosted Jul 15, 2021, 8:49 AM
Its generating error. The request failed. Error code: 'InvalidRequestContent'. Error 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 843.'.'.