web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / "ContentBytes: changes...
Power Automate
Answered

"ContentBytes: changes to 'Body' after selecting 'Get File Contents' and saving

(0) ShareShare
ReportReport
Posted on by 15

Hello,

 

I am trying to create a PDF attachment that includes form responses. I am using 'When a new response is submitted...', 'Apply to each','Get response details', 'create file', 'get file content', and 'send an email (V2)'.

 

The flow works properly and displays as a PDF attachment both on the e-mail and in my SharePoint site, however, the file is corrupt and will not allow me to view. The only error I can seem to find is that the 'Attachment Content' changes the "ContentBytes" to 'Body' after I save my flow, and does not keep 'Get File Contents'.

Does anyone have solution to this?

 

Thank you!!!
CJ

 

 

Error1.png

Error2.png

Error3.png

 

 

Error4.png

Error5.png

Screenshot 2023-01-03 104041.jpg
Screenshot 2023-01-03 104036.jpg
Screenshot 2023-01-03 104046.jpg
Categories:
I have the same question (0)
  • Verified answer
    AliB365 Profile Picture
    91 on at

    Hi @cjp18 

     

    If you want to create a PDF, you need to first create an html file.  Then you can convert the html to PDF using the OneDrive convert file action.  Using the following HTML as an example W3Schools Tryit Editor, we can save that into a compose (you could of course add in your dynamic content from the forms response).  You then create an html file using that content, you can then convert it to PDF and then you take the content from that action to create a new PDF file.

     

    AliB365_0-1672773186641.png

     

    If you've got any more questions please let me know.  I hope this helps.

     

    Ali B

  • cjp18 Profile Picture
    15 on at

    Ali B - This solution worked! Thank you so much! Is there any way with utilizing the OneDrive for Business to get these files to save in the SharePoint site rather than my personal OneDrive?

  • AliB365 Profile Picture
    91 on at

    Hi @cjp18 

     

    Yes 😉 the last action can be replaced with a create item on SharePoint instead of OneDrive.  The original html file will need to be created on OneDrive but the PDF can be created on SharePoint.  You might also want to delete the original HTML file on your OneDrive afterwards too with the delete file action.

     

    If you've got any more questions please let me know.  I hope this helps.

     

    Ali B

  • cjp18 Profile Picture
    15 on at

    THANK YOU! You were a magnificent help!!

  • valvon63 Profile Picture
    6 on at

    A different use case (invoice approvals generating an email with the approved invoice attached to the email), but same issue: "File Content" switching to "Body" in the "Attachment Content" field every time I save the flow. As such, the attachment in the tested or run flow will be a corrupted, unopenable file (regardless of file type) both for the initial approval notification and for the approval email attachment.

     

    I can't find any way to get the "File Content" to stick and not switch to "Body" and thus can't get my attachments into my flow. No idea what is going on.

  • Nic-AF Profile Picture
    on at

    I also noticed "File Content" kept switching to "Body".

    In my case, the pdf file is fine, it's just that I can't preview the PDF in Outlook (gives me error).  I have to double click to open it in Edge or Chrome to see the content.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 484

#2
11manish Profile Picture

11manish 282

#3
David_MA Profile Picture

David_MA 280 Super User 2026 Season 1

Last 30 days Overall leaderboard