Skip to main content

Notifications

Power Automate - Using Connectors
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?

  • mansa Profile Picture
    mansa 2 on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

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

  • asmusz Profile Picture
    asmusz 45 on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

    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.

  • mstr Profile Picture
    mstr 9 on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

    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

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

    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

  • Daivd_E Profile Picture
    Daivd_E 7 on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

    Hello,

     

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

     

  • v-yamao-msft Profile Picture
    v-yamao-msft on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

    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
    Daivd_E 7 on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

    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
    v-yamao-msft on at
    Re: Dynamics 365 Attachment to SharePoint Create File - Base64 vs Binary?

    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

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard

Featured topics