My users have requested that I export all files that they have attached to Cases so that they can place them in a repository for non SalesForce users to access.

In the past when I want to export actual files in previous Orgs, I have exported the Attachments object via dataloader.io and received a Zip file of all actual files. Unfortunately, I don't believe these Files/Attachments are stored in the Attachments objects because when I Query that object, I get zero results (there should be thousands). I believe that is because in the new SalesForce file system they are stored using Content Documents and Content Versions. However, when I try to export these a) I am unable to limit the query to those attached to only Cases and b) I do not actually get a zip of the files, just a CSV with the fields related to the records and some gibberish (file compression blob in csv form?) mixed in.

Users are attaching these files via the "Attachments" related list on Cases. What is the best way that you can recommend for me to export the actual files that are attached to all cases?

My first solution was to enable the "Query all Files" permission on my profile. This allowed me to see the full spectrum of files, however I am still unable to get actual files downloaded.

Thank you very much for your time.

  • Have you tried "Data Export" under "Data Management" in the sidebar? There's an option for "Include images, documents, and attachments" Commented Feb 14, 2019 at 21:04
  • Thanks @caleb.breckon! The weekly data export only exports the files as compressed "Files" with their record ID as the file name.
    – DC-Fencer
    Commented Feb 14, 2019 at 21:12
  • a solution from the past - FileExporter tool
    – cropredy
    Commented Feb 15, 2019 at 2:18
  • @cropredy Thanks for the reply; I had found that tool earlier however it's several years out of date. It requires Data Loader 17 which appears to have been scrubbed from the internet and most likely wouldn't even connect if it could be found. Thanks though!
    – DC-Fencer
    Commented Feb 19, 2019 at 22:41
  • v17 can be found here - Last time I used FileExporter was 3 years ago
    – cropredy
    Commented Feb 19, 2019 at 22:46

2 Answers 2


Correct! Using the email option, the client can attach Documents/Files and see those Documents/Files in the Case object. By using the SOQL option, you can only Download Case CSV files containing all the Records and Attachments details.

For quick exporting files from Case Object, you can easily use to standard AppExchange Application; This application will help you with ""Actual Export files for Attachments on all Cases"" We need to select the Object name from the drop-down and Hit Search Button and the download all cases Attchmnets with Actual Record Name and File name with record ID.


Disclaimer: I work at Satrang Technologies, ​the ​publisher of this Mass File Download AppExchange App.


There is no native or simple way to do this, but I have done something similar and summarized it in this article, you can easily customize it to solve your requirement.

export salesforce records with their attached files

In salesforce ContentDocuments (Files) are related to Entities (users, cases, opportunities ..) via ContentDocumentLink, you can export the files via Setup Export and the ContentDocumentLink via data loader, then you can put them all together and do some scripting to link them. enter image description here

And as a workflow for your specific case, I would say:

  1. Go to Setup -> Data Export -> Select Case Object + Include Salesforce Files and Salesforce CRM Content document versions. you will receive an email containing all the files, case records list, and contentDocumentLink records list.
  2. Grant your user the view all data and Allows View All Data users to SOQL query all files in the org permissions
  3. Use Data loader and select Show all objects to export the ContentDocumentLink records list.
  4. In the Data loader maybe you can also use the Case Id Prefix (500) to filter LinkedEntityId fields to only include ContentDocumentLink related to cases. (not sure of this !)
  5. If Step 4 is not valid filter using excel or a script any rows where the LinkedEntityId doesn't start with 500.
  6. write a script to remove all the files in the exported content version folder (you will get it from Step 1) with Ids that are not included in the export ContentDocumentLink!
  • 2
    Links tend to become invalid over time. Please edit your answer to reproduce the important parts here so your answer can still help others once that link becomes invalid.
    – Derek F
    Commented Jan 29, 2023 at 17:26
  • @DerekF done, thanks!
    – melbx
    Commented Jan 30, 2023 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .