cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Salesforce Attachment to Sharepoint

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?

8 REPLIES 8
Highlighted
Community Support
Community Support

Re: Salesforce Attachment to Sharepoint

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 Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Re: Salesforce Attachment to Sharepoint

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_refere...

 

Any ideas?

 

Thanks.

Highlighted
Community Support
Community Support

Re: Salesforce Attachment to Sharepoint

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

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
New Member

0oRe: Salesforce Attachment to Sharepoint

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

Highlighted
New Member

Re: Salesforce Attachment to Sharepoint

@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.'.

Highlighted
Advocate I
Advocate I

Re: Salesforce Attachment to Sharepoint

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?

Highlighted
Regular Visitor

Re: Salesforce Attachment to Sharepoint

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?


 

Highlighted
Regular Visitor

Re: Salesforce Attachment to Sharepoint

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/

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Solution Authors
Top Kudoed Authors
Users online (4,696)