cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Digital
Super User
Super User

Email PDF from SharePoint Document Library as an attachment.

User presses a button in Power Apps which generates a PDF in Flow using a HTML template in Power Apps. The generated PDF is saved to a SharePoint document library.

 

I was hoping to be able to send an email with the newly generated PDF as an attachment. I thought I could use Get File Content and use the output of this action to attach to an email but I receive an error in Power Apps - the flow doesn't even run. I get the following error:

 

Screen Shot 2021-01-26 at 10.21.10.png

 

As an alternative I was wondering if I could send the PDF file content data back to Power Apps and use this in an attachment control which I could then use to send the email from within Power Apps. The file content I receive in Power Apps is not recognised as correct format. Would I need to convert this to Base64 before sending back to Power Apps to be used in attachment control?

 

File content appears as follows:

 

Screen Shot 2021-01-26 at 10.38.45.png

2 REPLIES 2
Digital
Super User
Super User

I removed the Flow from Power Apps, re-added and now the email works. I would still love to know how to send file content back to Power Apps in a useable format though.

fchopo
Super User
Super User

Hello @Digital 

In the following post you can read an excellent explanation on the conversion to/from base64 and binary: Binary to Base64 in Microsoft Power Automate/ Microsoft Flow - Debajit's Power Apps & Dynamics 365 B...

You're right! Before returning the content to Power Apps, you should convert the base64 string to binary content using the function base64ToBinary().

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,113)