Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Flow corrupting files when moving to SharePoint from Dynamics 365



I have designed a Flow to move email attachments from Dynamics 365 to SharePoint folder. 


This Flow runs fine and moves attachments to the appropriate folders for individual entities. 


However, after the files have moved from Dynamics 365 to SharePoint, it appears that files are corrupted and can't open. 


I stored the image in SharePoint via Flow, here is what its showing: 




Here is the Flow: 


Flow error.PNG

Community Support
Community Support

Hi @PowerKS


It seems that you are using the dynamic content of Apply to each in the File content field. Please try to use the dynamic content Attachment from the action List records to see if it will work.



Best regards,

Mabel Mao

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

Hi Mabel, 


I have tried switching to Attachment and Body (Content of Attachment) but still getting this error.


Any other trick I can try to get this going?




Frequent Visitor


Did you manage to get this working eventuall?



Hello, @v-yamao-msft!

Thank you for posting a reply to a topic on the Microsoft Flow Community! It appears that the users who you have been engaging in this thread with are now awaiting your reply! Please follow-up on this thread ASAP.

Thank You!


Microsoft Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities
New Member

Hi PowerKS,

Is it possible to have your complete flow ? 

Thank you in advance.


Bets regards.



New Member

I have had the same issue and have found the reason why its happening. 

It is related to the Attachment body format being in base64 format. 

Sharepoint connector expects the file content to be in binary format due to which if you directly map the attachment body you will have a corrupted file.

In the file content mapping, use the expression 

base64ToBinary(<<parameterfor the body>>)
Hope it helps

@KaustubhHegde  What do you mean by << parameter for the body >> ?

Do you mean like, specific form fields like "name" or so? 

If that's the case, do I need to type that in front of every field?

New Member

I am having the same issue.  It does not appear you can save certain Outlook attachments to SharePoint or OneDrive.  I've attempted to use base64ToBinary( ), but cannot find the correct parameter to represent the attachment content.  There must be a way to easily convert attachments so that they are successfully saved.  Anyone?  Microsoft?




Helpful resources

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (13,127)