[SalesForce] How to delete ContentDocumentLink records massive

I want to free some space in salesforce related to Chatter Files or Files, I though all records are stores in ContentDocument object, but when I delete records from this object, the file storage still almost 100% or more. So I saw into the ContentDocumentLink if I delete the record from there my storage start to free space.

My question is how can I export all ContentDocumentLink records, now I'm able to export or query only one by one, for example :

SELECT ContentDocumentId,Id FROM ContentDocumentLink where ContentDocumentId='069A0000001WgPy'

If I don't use a filter this message appear:

enter image description here

There's a way to export all records or simply delete all of them?

Thanks.

Best Answer

Salesforce has a knowledge article describing the process of Deleting or Archiving items stored in Content: https://help.salesforce.com/apex/HTViewSolution?id=000176873

As well as an article about deleting items from Files: https://help.salesforce.com/apex/HTViewSolution?id=000198685

To answer your questions generally:

  • You use a report or data loader to produce a CSV file with the item IDs that you want to delete (from Content or FeedItem)
  • You use the CSV as the source file with DataLoader and you can delete the records in bulk
Related Topic