cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cymorg1
Advocate I
Advocate I

Downloading files from Salesforce

I'm trying to download file(s) attached to a custom entity in Salesforce and save them into SharePoint.  The file(s) seem to be saved in ContentVersion.VersionData however when I query this in Power Automate I get a partial URL (e.g. /services/data/v47.0/sobjects/ContentVersion/06809000002nZMJBB5/VersionData).  The ContentVersion contains all the file metadata like file extension, size, date created etc. but it doesn't contain the file content itself.  ContentVersion also contains an item called ContentBodyId which, when used to query the ContentBodies entity in Salesforce returns an error 

entity type ContentBody does not support query\r\nclientRequestId: 32143983-a2bb-4f01-b04e-a85b8ec5d2aa

So, where does the blob data for a file exist in Salesforce, and how can I retrieve it using Power Automate? 

1 ACCEPTED SOLUTION

Accepted Solutions
ResidentGeekUK
Frequent Visitor

Hi cymorg1,

 

I have been trying to figure out EXACTLY this solution as well.  You have to make a REST call to Salesforce to actually get the binary of the document.

After MUCH searching I found this brilliant article by Vivek Shukla on LinkedIn which after very carefully reading, re-reading and a bit of trial and error has given me a working example just this morning (I need to extend it to extract extra metadata and so on as efficiently as possible, but it works perfectly).  Be sure to follow it to the letter and also follow the article on connecting to Salesforce with Postman that he links to.

(7) SharePoint Online and Salesforce Integration Including Attachments | LinkedIn

How to connect to Salesforce with Postman ? - SFDC Stop

View solution in original post

1 REPLY 1
ResidentGeekUK
Frequent Visitor

Hi cymorg1,

 

I have been trying to figure out EXACTLY this solution as well.  You have to make a REST call to Salesforce to actually get the binary of the document.

After MUCH searching I found this brilliant article by Vivek Shukla on LinkedIn which after very carefully reading, re-reading and a bit of trial and error has given me a working example just this morning (I need to extend it to extract extra metadata and so on as efficiently as possible, but it works perfectly).  Be sure to follow it to the letter and also follow the article on connecting to Salesforce with Postman that he links to.

(7) SharePoint Online and Salesforce Integration Including Attachments | LinkedIn

How to connect to Salesforce with Postman ? - SFDC Stop

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,882)