web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Dynamics 365 Attachmen...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 7

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?

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    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

  • Daivd_E Profile Picture
    7 on at

    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.

     

     

     

     

     

     

  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    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

  • Daivd_E Profile Picture
    7 on at

    Hello,

     

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

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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 Profile Picture
    9 on at

    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

  • asmusz Profile Picture
    45 on at

    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.

  • mansa Profile Picture
    2 on at

    Hello, please can you be so nice to post the flow you used

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 58

#2
David_MA Profile Picture

David_MA 53 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 36 Most Valuable Professional

Last 30 days Overall leaderboard