cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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?

7 REPLIES 7
Community Support Team
Community Support Team

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

Community Support Team
Community Support Team

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.
Sunilprakash7
Level: Power Up

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?

Raghava
Level: Power Up

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
ericscales
Level: Powered On

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?

DevOps
Level: Power Up

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?


 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 187 members 4,566 guests
Please welcome our newest community members: