cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rjm
Level: Powered On

Sending an email with variable number of attachments

I built a flow that drafts a specific type of email that my colleague sends out regularly. This email has to have PDF attachments that are pulled from one of our SharePoint libaries. Normally the emails contain two, but occasionally they contain three.

 

My issue is that the Send Email action fails if I've specified that there is an attachment name but instead the action receives a null value (since there is no attachment). 

 

What I'm looking for is a way to create a custom Send Outlook Email connector that has flexibility built into the attachments section - the connector might have room for five attachments, but if an attachment isn't supplied, it doesn't error out. Does anyone know how I could go about doing this?

 

I even started to recreate the entire email generator in PowerApps, but I found that PowerApps can't pass PDFs to the table it requires for adding attachments to an email (it can only handle media files with their content stored as BLOBs).

1 ACCEPTED SOLUTION

Accepted Solutions
v-zhos-msft
Level 10

Re: Sending an email with variable number of attachments

Hi @rjm ,

As you said, the pdf files are in a SharePoint library.

Are there other files you don't want to send as attachments in that library?

I have made a test on my side, I save the PDF files in one library without other files.

 

Capture.PNGCapture1.PNG

Expression reference:

Capture2.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

2 REPLIES 2
v-zhos-msft
Level 10

Re: Sending an email with variable number of attachments

Hi @rjm ,

As you said, the pdf files are in a SharePoint library.

Are there other files you don't want to send as attachments in that library?

I have made a test on my side, I save the PDF files in one library without other files.

 

Capture.PNGCapture1.PNG

Expression reference:

Capture2.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

rjm
Level: Powered On

Re: Sending an email with variable number of attachments

@v-zhos-msftThank you so much! I spent 30 hours trying to devise workarounds before you shared this with me. I didn't know supplying the attachments field with an array would get around the issue. The only change I made to what you described was that I entered "ContentBytes" instead of "ContentByte" (for any users who try this method). I really appreciate the help.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 4 members 5,239 guests
Please welcome our newest community members: