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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (5,176)