Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to the Salesforce documentation on ContentDocument

Users (including users with the “View All Data” permission) can only query files they have access

I find this very strange. Why would a System Administrator not be allowed to see all ContentDocument records within Salesforce?

Is there a way to circumvent this limitation?

EDIT: The weirdest thing about all this is that the Admin user can see the ContentDocument in the Salesforce web interface.. but they can't be obtained through the API. That makes little sense. I'd expect the API to show as much or more data than the web interface, not the opposite.

share|improve this question

This question has an open bounty worth +100 reputation from CoryCowgill ending in 6 days.

Looking for an answer drawing from credible and/or official sources.

I have a requirement to SOQL and get all ContentDocument records, for example [Select Id, Title from ContentDocument]. This SOQL needs to match the Web UI so I can get all the same Files that are exposed in Files Tab. I am looking for someone to confirm if this is even possible (the answers below are not correct for the question)

"Why would a System Administrator not be allowed to see all ContentDocument records within Salesforce?" : Are you able to change the settings for System Admins and make it disable for them? – Forceguru Oct 12 '12 at 3:22
What do you mean? My main objective is not to hide the ContentDocuments that do not belong to the administrator. I want to see all the ContentDocument records through the Salesforce API. Since the administrator can see them within the web interface, I'd expect him to be able to see them through the API. – GuiSim Oct 16 '12 at 17:50
This question was asked several years ago and the USING SCOPE does not solve ALL permutations. The question is how do you SOQL to get all ContentDocument records without doing work arounds like querying all the ContentDocumentLink records. – CoryCowgill 12 hours ago

We had a similar issue with Report and it turned out the reports were under the Private space of the owners. In our case, this query gives us the full data:

Select id,name,ownerid from report USING SCOPE allPrivate

share|improve this answer

As advised by David Ha, you should add a "USING SCOPE" option in your SOQL query in order to retrieve all the ContentDocument records. Strangely, I found that "USING SCOPE Everything" restricts the data to Owned files only, while "USING SCOPE Team" gives all ContentDocument regardless of Owner and sharing.

So this query did the trick for me (on API version > 32) :

Select Id, Title, FileExtension, CreatedDate From ContentDocument USING SCOPE Team
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.