[SalesForce] Not able to delete all contentDocuments even as an admin in salesforce through apex

I am unable to delete the contentDocument(Files) owned by some other user even as an admin. I am trying it through apex. When I write a SOQL query it only retrieves records that are owned by me, if some more records are there with owner as someone else then it will not appear in query results.

SOQL Query that I am trying is SELECT ID, OwnerId, title, ParentId from contentDocument USING Scope Everything

Best Answer

With Spring 19' update there is a new setting in the "App Permission -> Content -> Query All Files: Allows View All Data users to SOQL query all files in the org".

This is not enabled by default for the admin user but you can at least enable it in a Profile/Permissions Set.

Also, now documented in https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentversion.htm.

Related Topic