cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daivd_E
Frequent Visitor

Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

I have had some issues Creating a file in Sharepoint from items attached in Notes for Dynamics 365.
 
1) The Dynamics "when record created" triggers anywhere up to 7 hours delayed. (this is a sidenote, but is making testing hard).
2) Data stores in Dynamics is in Base64.
 
My orignial Process was:
1. Dynamics 365 - When Record Created
2. Check if note has Document
3. Sharepoint - Create File
This would correctly create the file in sharepoint, but i could not preview the jpg.
when i downloaded the jpg i noticed a size difference,
i opened the jpg in notepad to find a string of the Base64 data.
 
I found a workaround using logic apps functions "@{base64toBinary()}", i put this in a compose operation before the Sharepoint -Create File and used the output as the Document Body.

However i could still not preivew the file.
I downloaded again and opened again in a text editor, to find it WAS in binary but that the conversion was off.
Opening in a hex editor you can see some discrepancies between the two, but the meta data seems mostly there.
 
Is there a correct Flow process to get datatypes to be the same? when dealing with files is there a correct method of converting them? is this just incomplete flow controls not handing data times correctly? is it a bug, incomplete or am i just not doing it correctly?

7 REPLIES 7
v-yamao-msft
Community Support
Community Support

Hi Daivd_E,

 

How did you configure the condition “check if note has document”?
Could you try to add File Type after the File name to see if it works? E.g. “.jpg”.

1.png

 

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.

Hello,

sorry it took me some time to work out the nuance of inserting an image into the forum.


I start with getting notes when one is created. - from CRM trail can take up to 4 hours to trigger? - but works.

then filter on when it relates to a work order. - works as expected

2017-04-11 09_18_59-Manage your flows _ Microsoft Flow.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Then i filter where isDocument is true. - using advance because "true" does not equal true.2017-04-11 09_19_26-Manage your flows _ Microsoft Flow.png

 

 

 

 

 

 

 

 

 

 

 

Then Currently i attemp to convert from base64 to binary, but inserting into a compose field the value: "@{base64toBinary(triggerBody()?['documentbody'])}"

once saved this for some reason hides the code but still preforms the desired action.

 

then i try inserting into Sharepoint.


2017-04-11 09_19_54-Manage your flows _ Microsoft Flow.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

From the outputs you can see the filename and type are being identified correctly.

and there is no errors.

 

2017-04-11 09_31_10-Manage your flows _ Microsoft Flow.png

 

Trying to open it in sharepoint returns:

2017-04-11 09_40_21-Test Work Order Attachments - maxresdefault.jpg.png

 

This is the sample output from the saved file being opened with notepad when NO Base64toBinary convertion happened:

2017-04-11 09_36_03-Invoice (1).txt - Notepad.png

 

as you can see it just populated the file with a base64 string.

 

once i added the base64 to binary convertion in the compose task i get these different files:

correct on the left, incorrect on the right.

2017-04-11 09_29_48-apples2-Incorrect.txt - Notepad.png

as you can see its close, and with a Hex editor its actually very simular, however i am not sure where it goes wrong.

 

The out of the box solution does not hold a constistant type for files, and i feel flow should take care to tranform data to one type when dealing with it internally and converting where required on the save and retierve connectors.

 

 

 

 

 

 

Hi Daivd_E,

 

Thanks for your detailed information.

 

I have reported this issue on my side, I will back to you once I got any response about this issue.

 

Thanks for your patience and understanding.

 

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.

Hello,

 

has there been any updates on transfering files from CRM to sharepoint?

 

Anonymous
Not applicable

Hi, Firstly thanks for the top idea, as I have a requirement to do this.

 

If I add the base64ToBinary

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

to the Create File Area, it seems to work correctly and I can open the files.

 MSFlowStep.PNG

 

thanks Justin

mstr
Regular Visitor

Yours is working?

 

I just gave your solution a shot and I'm still unable to get usable files. Can you post your whole flow?

 

Thank you!

 

mstr

Yes ... please post your whole flow?  I've been trying to figure out how to get files from Dynamics as well.

 

I'd like to use them for passing into a different connector but can't even figure out how to get them out.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,154)