web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sending email with pop...
Power Automate
Unanswered

Sending email with populated file attachment as well as file from SharePoint

(0) ShareShare
ReportReport
Posted on by 44

I have a flow that populates a Word doc and converts it into a PDF. 

The data comes from SharePoint which gets it from a form submission in PowerApps.

The user also attaches files in PowerApps which will be stored in the SharePoint list.

 

I need both the converted PDF file as well as the attachments from SharePoint to the sent with the email.

 

I have searched the web far and wide but only every found one or the other solution but not both. I am able to either attach the PDF file OR the SharePoint files but not both. 

 

Please help! Thank you.

Screen Shot 2020-10-14 at 2.30.13 pm.png

This is my flow for getting the attachments from SharePoint. If anyone can help, I'm happy to expand and upload more screenshots.

Categories:
I have the same question (0)
  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @MSSAdmin,

     

    It seems that you have successfully added item attachments to the attachments array. The next thing you need to do is add another Append to array variable action, and add the PDF file to the attachment array.

    {
     "Name": "@{outputs('Create_file')?['body/Name']}",
     "ContentBytes": "@{base64(outputs('Convert_Word_Document_to_PDF')?['body'])}"
    }

    Screenshot 2020-10-14 151527.jpg

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • MSSAdmin Profile Picture
    44 on at

    Thanks for your help.

    Unfortunately I still only get the attachments from SharePoint. The flow runs fine, there are no errors, I just don't received the PDF attachment with my email.

    I have added an "initialise variable" and "append to array variable" step but I'm also not sure where they should be positioned in my flow.

    Please see screenshots below.

     

    Flow expanded.png

    Flow steps.png

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @MSSAdmin,

     

    Because you put PDF file and attachments in two different variables, and I assume that you just put the variable Multiple attachments into the Email, right?

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • MSSAdmin Profile Picture
    44 on at

    There is only one box to add which attachment are added to the email so I added both variables with a ";" and also tried "," and also no comma.

    I get the following error message:

     

    Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'emailMessage' validation failed in workflow operation 'Send_an_email_(V2)': The parameter with value '"@{variables('Multiple Attachments')}; @{variables('EmailAttachments')}"' in path 'emailMessage/Attachments' with type/format 'String' is not convertible to type/format 'Array'.'.

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @MSSAdmin,

     

    Please not to do that, you just need to do is delete one of the two variables, then Append the PDF file and Attachments file into a variable at the same time. Then put the variable into the Email, it could work.

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

  • MSSAdmin Profile Picture
    44 on at

    Great it finally worked!

    Thank you for your help 🙂

  • MSSAdmin Profile Picture
    44 on at

    I have another question:

    When trying to attach more than 1 picture as an attachment, I get sent an email and there are two problems with it:

    1) I get sent the two pictures I attached (as it should) but also the filled in PDF twice.

    2) I can't open the pictures nor the pdfs that are attached.

    The error message for the pdf file is: 
    Adobe Acrobat Reader could not open 'Draft - Hrunf[2].pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

     

    The error message for the photo is:
    The file “2E4B625D-218F-4615-AB41-DAC574185066[1].jpg” could not be opened. It may be damaged or use a file format that Preview doesn’t recognise.

     

    Any suggestions on why that happens?

     

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @MSSAdmin,

     

    You could refer to my first reply, use the base64() function convert the file content into base64 code, and try it again:

    {
     "Name": "@{outputs('Create_file')?['body/Name']}",
     "ContentBytes": "@{base64(outputs('Convert_Word_Document_to_PDF')?['body'])}"
    }

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • MSSAdmin Profile Picture
    44 on at

    I'm getting the following error message when doing that:
    Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The action(s) 'Create_file' referenced by 'inputs' in action 'Append_to_array_variable' are not defined in the template.'.'.

     

    Honestly I'm losing my mind over this whole thing. I have tried for several hours almost non-stop to find a solution and all I get is more problems.

    I have two flows that are the same, they just get content from two different form submissions in PowerApps/SharePoint. Therefore I copy/pasted one flow and adjusted what was needed for the other

    (i.e. SharePoint list name etc).

    However they both act differently.

    While one doesn't give me any attachments at all, the other one worked a few hours ago but with corrupt attachments and now I'm not even getting an email sent.

    This whole time though, the flow works fine. I don't get error messages, only the green "Your flow ran successfully".

    Screen Shot 2020-10-19 at 1.50.06 pm.png

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @MSSAdmin,

     

    Thank you for your patience and explanation of the situation. 

    The error that Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The action(s) 'Create_file' referenced by 'inputs' in action 'Append_to_array_variable' are not defined in the template.'.' is caused by the action name not correct.

    I can see that you have renamed the Create file action, so the expression should be corrected to:

    {
     "Name": "@{outputs('Create_PDF_file')?['body/Name']}",
     "ContentBytes": "@{base64(outputs('Convert_Word_Document_to_PDF')?['body'])}"
    }

     

    The reason for the file has been damaged is caused by the send Email action only accept base64 format, so we should force the contents of the file to base64 code in case some file content isn't.

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard