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

MS Flow corrupts file

Hello Experts

I have an MS flow, which is uploading Note attachment to SharePoint on note creation. When I try to open the file in SharePoint, It gives the file content/corrupt error.

CRM is an online trial version

Can someone help?

1 ACCEPTED SOLUTION

Accepted Solutions
HaiderShah1
Level: Power Up

Re: MS Flow corrupts file

@v-yamao-msft hello

 

thanks for the reply. it is already fixed. converting the content of the file to binary worked for me.

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

 

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: MS Flow corrupts file

Hi @HaiderShah1 ,

 

Do you want to upload Dynamics 365 Notes attachment to SharePoint library when a Note is created?

 

Please check the following scenario for a reference.

 

In my scenario, I will upload Note attachment which is related to Accounts entity to SharePoint library.

 

Add the trigger When a record is created in Notes entity.

 

Then Get the related Accounts entity using action Get record.

 

Initialize a time string variable, set the Value with the following code:

addMinutes(utcNow(),1)

 

Add Delay until action.

 

List records in the Document locations entity with the following code in Filter query:

_regardingobjectid_value eq Account

By the way, configure the Top count value to 1 to limit the results to one record.

 

The last step is to create file in SharePoint library. Specify the Site Address and Folder path, select dynamic content File Name for File Name field, and for File content field, input the following code:

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

 

When a note is created, the attachment will be created in SharePoint library, and it won’t corrupt.

1.PNG2.PNG3.PNG

 

Best regards,

Mabel

 

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.
HaiderShah1
Level: Power Up

Re: MS Flow corrupts file

@v-yamao-msft hello

 

thanks for the reply. it is already fixed. converting the content of the file to binary worked for me.

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

 

View solution in original post

gurmeetKRahi
Level: Powered On

Re: MS Flow corrupts file

I am also getting this error while adding a .docx or .xlsx file as an attachment in a list item using microsoft flow.

Any help will be appricated.

RajnishP
Level: Powered On

Re: MS Flow corrupts file

Hi @HaiderShah1,

 

It might have worked for you. The actual issue is file sharing and security.

Late last year, there was a security update on how file importing is to be done in SharePoint. Files cannot be shared publicly but there must be a specific audience to whom it can be shared. This needs to be made aware to the users to this application.

 

In short share with Everyone.

 

 

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Kudoed Authors
Users online (3,928)