Skip to main content
Community site session details

Community site session details

Session Id : Ml5VEx2tidGmDE4ISqRrQo
Power Automate - Building Flows
Answered

PDF file corrupted when attched to an Email

Like (0) ShareShare
ReportReport
Posted on 3 Aug 2018 11:26:23 by 23

Hi,

 

 i have a flow that reads a note form Dynamics 365. I do get a proper base64 string that i can decode to get the actual pdf-file using e.g. base64decode.org.

 

However, when i attach the file to an "Office 365 Outlook - Send email action using: decodebase64(BASE64STRING) i dont get an error in flow but the file received in outlook is corrupt and cannot be opened. Flow_setup_SendEmail_Action.PNG

 

I also noticed that the filsize shown as email attachment is actually ~25% larger than the acutal file from Dynamics. 

 

 

  • Pashket Profile Picture
    3 on 20 Nov 2023 at 02:58:12
    Re: PDF file corrupted when attched to an Email

    Thank you so much for this comment, you saved my day!

  • alejandradlt Profile Picture
    2 on 01 Apr 2022 at 21:59:57
    Re: PDF file corrupted when attched to an Email

    I have a similar problem, my flow creates a pdf in SharePoint file out of a paginated report. The flow then emails to file as an attachment. I can open the pdf file in SharePoint just fine, but the attachment in the email is corrupted. Has anyone been able to solve a similar case?.  This particular flow starts with a Power App. But I have another flow that runs with a timer, and the attach a pdf file to an email that is not corrupted!! 

  • tlfmd Profile Picture
    2 on 20 May 2019 at 19:05:40
    Re: PDF file corrupted when attched to an Email

    PDF file obtained from HP MFP277 was emailed and received corrupted, as was the original file still on computer.

    It was readable prior to emailing

  • Verified answer
    Michael Dohr Profile Picture
    23 on 09 Aug 2018 at 09:27:16
    Re: PDF file corrupted when attched to an Email

    Ok, 

     

    in the end this was an easy "fix". 

    I had to use "Base64toBinary" in the expression to convert my Base64-string. 

    Flow_Solution.PNG

     

     

     

  • Erik-de-Rooij Profile Picture
    23 on 09 Aug 2018 at 09:18:06
    Re: PDF file corrupted when attched to an Email

    I never used files from Dynamics 365 before, but you could probably save the file to Azure storage (or SharePoint/OneDrive for debugging) and check if the PDF is correct. If so, you could attach the file from that temporary location and delete it afterwards.

     

    Just a thought to keep you going.

     

    Best regards,

    Erik

  • Michael Dohr Profile Picture
    23 on 09 Aug 2018 at 09:05:46
    Re: PDF file corrupted when attched to an Email

    Hi,

     

    i just realized that the same thing happens to *.docx files. Looks like every document im reading form a note inside dynamics gets corrupted when sending it as an outlook email attachement. 

     

    Has anyone tried reading a doucment from a note inside DYnamics 365 and and send it by email via Office 365 Outlook?

  • Michael Dohr Profile Picture
    23 on 06 Aug 2018 at 11:04:40
    Re: PDF file corrupted when attched to an Email

    Hi, 

     

    here you go. 

    P.s. basically im reading the document from a note inside Dynamcis 365. This note is attached to a custom entity.

     

    Flow is triggered by a Canvas App. via  creating a custom entity called "mscrm-addons AutoMergeWorkingitem" a document generation process is triggered. Once the item becomes inactive the document can be grabbed from a lookup to another custom entity that has the document stored as a note. from there i read the file (as base 64) and then try to send it off by email.

     

    Flow triggered by Canvas App - read custom entity and create a ew one (AMWorkingitem) - this generates a document

     

     

    thanks

  • v-yuazh-msft Profile Picture
    on 06 Aug 2018 at 02:06:14
    Re: PDF file corrupted when attched to an Email

    Hi @mathocom,

     

    Could you please share a full screenshot of the configuration of your flow?

    How could you get the proper base64 string?

     

    Please share more details so we would try to provide a proper workaround for you.

     

    Best regards,

    Alice

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete