cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jim_W
Level: Power Up

File created is corrupt

Hi, I am building a flow for controlled documents. I have a SharePoint list where the user uploads a draft document with metadata and then an appoval workflow. Once the document has been approved, the flow creates the file in the Document Library and then updates the file with the metadata. It is all working fine except I get an error, "Sorry, this document can't be opened for editing" and when I open in Word I get the error "Word found unreadable content in the ....doc name.... Do you wan to recover the contents of the document?". Every file gives the same error, Word, Excel, PDF, the only one that I could open was a 1 line text file.

 

I Think I need to do soemthing like HaiderShah1 post https://powerusers.microsoft.com/t5/Using-Flows/MS-Flow-corrupts-file/td-p/249659 but I'm a novice at SharePoint and have tied myself in knots trying to figure out the string for the base64ToBinary function. Could you please help

 

Update, I have added

 

base64ToBinary(body('Get_attachment_content')?['$content'])
 
to the Create File but the file is still corrupt 
 
Update #2
 
It would appear that I had some white space before base64ToBinary(body('Get_attachment_content')?['$content'])
I have removed the white space and the files no longer corrupt (but only a sample size of 2) 
JSON.png
 
 

 

Thanks

base64ToBinary(triggerBody()?['documentbody'])

Flow.png

 

2 REPLIES 2
Highlighted
Community Support Team
Community Support Team

Re: File created is corrupt

 

Hi @Jim_W ,

 

Please try to use base64ToBinary(body('Get_attachment_content')).

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Jim_W
Level: Power Up

Re: File created is corrupt

Hi @v-bacao-msft 

 

Thanks for the suggestion, but I received an error. I think I am on the right track with my update but may have to use an array with $content-type

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,849)