function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
-_--_- 

How to export VersionData from ContentVersion object for Large files

I am trying to pull contentVersion out of one org and push it into another cloud based file storage system and it is providing a lot of challenge given that I am unable to find a way to export the VersionData field for large files.

Has anyone found a way to do this?  Here is what I have tried (and failed):
Batch Apex - failed whenever a file larger than the heap space (12MB for batch) was queried
Bulk API using Java - you are not even allowed to query the VersionData field... wish I knew this before I wrote a whole program to retrieve it...

I am at a loss as to how to export the data in a way that I can rebuild it and upload to another cloud based system.  

 

any help is greatly appreciated as I am going mad :(

Amit Chaudhary 8Amit Chaudhary 8
I hope your issue is resolved in below post
1) https://developer.salesforce.com/forums?id=9060G000000Bc2vQAC

Let us know if you need more help ?
-_--_-
That's my original post on the same topic lol
 
Mandeep Singh 146Mandeep Singh 146
Hi  -_- after lots of hard work and search im able to find a workaround for this issue. You can use force:recorddata similar as I've mentioning below:
<force:recordData aura:id="recordLoader"
    recordId="{!v.recordId}"
    fields="Id,Title,VersionData,PathOnClient"
    targetError="{!v.recordLoadError}"
    targetFields="{!v.fileRecord}"  
    recordUpdated="{!c.handleRecordUpdate}"                    
    />
for handling the multiple files you have to handle the recordId dynamically. You can do this by using the code below.
component.set("v.recordId",currentRecId);
var RecordId = component.get("v.recordId");
/component.find("recordLoader").set("v.recordId", RecordId);
 component.find("recordLoader").reloadRecord();

This worked for me hope this works for you as well.
Mark this as a best answer if its helpful.

Thanks
Mandeep
FERNANDO RUIZ 16FERNANDO RUIZ 16
Hello, I have the same issue for geeting the info of a large file ( mainly versiondata field) linked to the sobject record. I ask if finally it works force:recorddata