Forum Discussion
Bayan000
Nov 03, 2023Copper Contributor
Sending a PDF file as an email attachment with Power Automate corrupts attachment
I have followed this great tutorial for creating and sending digital certificates to event participants (https://techcommunity.microsoft.com/t5/educator-developer-blog/send-digital-certificate-to-eve...
Bayan000
Nov 05, 2023Copper Contributor
The issue was resolved on its own by using the old flow editor instead of the new designer.
amytucker714
Apr 06, 2024Copper Contributor
Bayan000 , Hi. I am using my organization's web based version of Power Automate which does not have an option for reverting to the old designer. Is there a fix for those of us stuck in the new designer? Thank you very much.
- WCarterMVUSDJun 18, 2024Copper Contributor
I've seen this kind of issue before with writing JPG files to Blob storage, there's something funky with the new editor that it mungs up parsing binary/base64 conversion unless the code is edited. I'm not sure if you can do this in Power Automate, but in logic apps in the code designer you can find the email attachment field and remove the outermost curly braces from the contentData string:
"attachment": [{"contentData": "@{body('Convert_Word_Document_to_PDF')}","contentType": "application/pdf","fileName": "Report.pdf"}becomes:"attachment": [{"contentData": "@body('Convert_Word_Document_to_PDF')","contentType": "application/pdf","fileName": "Report.pdf"}I don't know why that fixes it but the old editor doesn't add the extra curly braces around your function while the new editor does, iirc it's related to how the underlying engine parses data inside curly braces vs without as it implies some kind of typing that totally breaks things. If you can't edit the code directly you might be able to get it to work correctly by using the Expression editor and selecting the PDF output there instead of using the dynamic expression shortcut (lightning bolt).- daisysx1987Jun 19, 2024Copper Contributor
Thank you this helped!WCarterMVUSD