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 / Salesforce Attachment ...
Power Automate
Unanswered

Salesforce Attachment to Sharepoint

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I'm trying to build a flow that takes a Salesforce attachment and attaches it to a Sharepoint list. I'm having some trouble getting the attachment to actually upload to sharepoint correctly, and I believe it's due to the way I'm encoding it.

salesforceToSharepoint.png

 

 

I know on Salesforce the Body is encoded with base64... I've tried decodeBase64 but no luck. Has anybody had any luck with anything like this?

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

    Hi @Anonymous,

     

    The File Content field of "Add attachment" action is required to fill a binary content, please consider take a try with the following workaround:15.JPG

    Within File Content field of the "Add attachment" action, type the following formula:

    base64ToBinary(triggerBody())

    More details about the "Add attachment" action of SharePoint connector, please check the following article:

    "Add attachment" action of SharePoint connector

     

    Best regards,

    Kris

     

     

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-xida-msft,

     

    I have tried to use base64Tobinary as suggested however I recieve the following:

     

    "'base64ToBinary' expects its parameter to be a string. The provided value is of type 'Object'."

     

    I tried just using triggerBody() after this, however this did not work either, but gave me no errors, just a corrupt file.

     

    I am using this for reference:

     

    https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_Attachment.htm

     

    Any ideas?

     

    Thanks.

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

    Hi @Anonymous,

     

    You could consider take a try with the following formula within File Content file of "Add attachment" action:

    base64ToBinary(string(triggerBody()))

    Please check if the above formula works in your flow. If you have any questions, please feel free to reply here.

     

    Best regards,

    Kris

  • Sunilprakash7 Profile Picture
    15 on at

    I am using the formula above but still getting the error. can you tell me if I am missing anything?

  • Raghava Profile Picture
    2 on at

    @v-xida-msft

    Hello Kris,

    I am getting the below error, when i used "base64ToBinary(string(triggerBody()))" in the formula. Please suggest me.

     

    InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '2481': 'The template language function 'base64ToBinary' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.'.

  • ericscales Profile Picture
    3 on at

    I'm also getting errors, however, it appears the SalesForce connector is passing along a URL as the attachment content.  Has anyone gotten anything to work with SalesForce attachments?

  • DevOps Profile Picture
    4 on at

    Having trouble as well in retrieving attachment data, how may we use the URL given by SalesForce to retrieve the actual data? it seems the only way is to do this through code and not through Microsoft Flow, Flow returns a body:

    /services/data/v44.0/sobjects/Attachment/{AttachmentID}/Body...

    This doesn't help...


    @Anonymous wrote:

    Hi all,

     

    I'm trying to build a flow that takes a Salesforce attachment and attaches it to a Sharepoint list. I'm having some trouble getting the attachment to actually upload to sharepoint correctly, and I believe it's due to the way I'm encoding it.

    salesforceToSharepoint.png

     

     

    I know on Salesforce the Body is encoded with base64... I've tried decodeBase64 but no luck. Has anybody had any luck with anything like this?


     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

    In Salesforce Lighting Version - Attachment object is deprecated, so you can use another approach to do that please follow my below link to achieve the solution: 

    https://www.linkedin.com/pulse/sharepoint-online-salesforce-integration-including-vivek/

     

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard