Please wait, loading...

 

SharePoint file created from power automate flow doesn’t show open correctly or corrupted.

May 20, 2023

created a file from a Dynamics 365 CRM record attachment and when I try to load it into SharePoint it doesn’t create or read correctly?

Even if it appears to upload correctly, it may not open properly and display something like this:

Consider the following scenario. Suppose you have attached a document in SharePoint and want to save it in Notes.

  1. Let’s say you have uploaded this PDF document to Notes and now you want to upload it to SharePoint.
  2. I have a flow that sends this document to SharePoint that runs when I create a note in the Dataverse (Dynamics 365 CRM).”
  3. Now the “Create File” action in SharePoint looks like this:
    This allows the SharePoint file creation action to add the document to the file context. Hovering the mouse over this will result in triggerOutputs()?[`body/documentbody`].
  4. Running this flow creates a document in SharePoint. However, when I open the file, I get an error message that the file cannot be read, even though the file appears to upload correctly.Please click on the link to find correct way to

    Create a file from a Dynamics365 CRM record attachment notes and move to SharePoint documents. without corrupted file.

Use base64ToBinary conversion

Here’s a step to create a File in SharePoint in your mentioned SharePoint library –

  1. In order to correctly pass this through, use the base64ToBinary expression in the Create file’s File Content field.
  2. And in base64ToBinary, put the Document so that it looks like this – “base64ToBinary(triggerOutputs()?[‘body/documentbody’])“
  3. And when you re-run the test, the document will be created in the same way.
    And now when you open it, it’ll open properly.

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651
Microsoft Dynamics Community Profile

Learn more