I ran this query below

select id, owner.name, ownerid, title from contentdocument where id = '0695i000007L0FIAA0'

I got this results which shows me the owner id

enter image description here

I then ran another query trying to find all records which belonged to the owner from the above query. But it shows nothing

select id, owner.name, ownerid, title from contentdocument where ownerid = '0052j000000M0XtAAK'

I've noticed on the ContentDocument object when i run a query it doesnt show everything. Is that supposed to happen? I'm not able to find all the records for certain queries but if I use a different query i get different results which is confusing.

Anyone able to shed some light on this?

enter image description here

  • this must be some limitation of the tool you are using; Select id, ownerId, title from ContentDocument where ownerId = '0052j000000M0XtAAK' if executed in a soql builder will definitely return the rows
    – cropredy
    Oct 13, 2022 at 0:53

1 Answer 1


When I try with below query i am able to get the contentDocument records based on ownerid.

   select id, owner.name, ownerid, title from contentdocument where ownerid = '0052j000000M0XtAAK'

By default, users (including users with the “View All Data” permission) can only query files they have access to, including:

  1. Salesforce Files in their personal library and in libraries they're a member of, regardless of library permissions (API version 17.0 and later).

  2. Salesforce Files they own, shared directly with them, posted on their profile, or posted on groups they can see (API version 21.0 and later).

Enable the Query All Files permission to let your View All Data users bypass the restrictions on querying files.

  1. Query All Files returns all files, including files in non-member libraries and files in unlisted groups.

  2. Users can’t edit, upload new versions, or delete files they don’t have access to.

  3. View All Data permission is required to enable Query All Files.

Refer the Document

Refer Obtaining all ContentDocument records using SOQL

You must log in to answer this question.

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