cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hairulhazri
New Member

OneDrive for Business Create File, File Corrupt

Hi,

 

 

I'm building two different flows with the same goals, using different approach. The goal is to convert docx files to pdf files. In order to do that, I need to create docx file in OneDrive folder before converting the file to pdf.

 

The first flow is automatically triggered when docx file in Note entity creation. Flow will create docx file based on the created Note, then convert it to pdf, then create new Note as pdf, then delete the original docx Note.

This flow is able to run successfully.

automated triggerbody.png

 

automated success.png

 

The second flow is manual flow. This flow should select all docx files in Note entity. For each file, the flow should create docx file in OneDrive, convert the docx to pdf, then create new Note as pdf, then delete the original docx Note.

This flow, however, failed at conversion to pdf step because the docx file created cannot be read.

manual applytoeach.pngmanual failed.png

 

I notice the difference in File Content value on Create File step.

It's obvious that because of different approach, I couldn't get the correct value in the manual flow. But I'm struggling to understand. What's the correct expression I should use with applytoeach to return the correct File Content value?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @hairulhazri,

 

The dynamic content Document does not contain the content type, so you could structure it before append it into File content field, you could do like below:

{
"$content-type": "@{items('Apply_to_each')?['mimetype']}",
"$content": @{items('Apply_to_each')?['documentbody']}
}

 

Annotation 2020-09-09 111854.jpg

 

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-litu-msft
Community Support
Community Support

Hi @hairulhazri,

 

The dynamic content Document does not contain the content type, so you could structure it before append it into File content field, you could do like below:

{
"$content-type": "@{items('Apply_to_each')?['mimetype']}",
"$content": @{items('Apply_to_each')?['documentbody']}
}

 

Annotation 2020-09-09 111854.jpg

 

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Currently trying to create a docx file that contains an html table I did with the action in power automate.

If I create the file with the .docx it won't open from Word online or desktop. And if I create the file with the .doc extension it works and it opens to show the HTML table correctly but then I can't convert a .doc file into a PDF.

Basically I just want to create a docx file with a html table in it to the convert it to PDF.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,468)