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
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,072)