I converted all Notes and Attachments which are associated to Case object to Files. When I run a SOQL query on ContentVersion to see all the Files, I don't see all the files.

Case has Public Read/Write/Transfer sharing setting. Can any one tell me what mistake I am making. I used Salesforce Notes and Attachment Magic Mover to move all attachments to Files.

Here is the SOQL which i am using:

SELECT Description,FileExtension,FileType,Id,Title FROM ContentVersion
  • Where is your SOQL? Share it please by editing your question and placing your relevant code snippet. – Mahmood Apr 4 '18 at 14:52

There are unique features to data access with ContentVersion. In particular, the "View All Data" permission does not apply.

From the ContentVersion reference:

Users (including users with the “View All Data” permission) can only query files they have access to, including:
* All Salesforce CRM Content files in libraries they're a member of and in their personal library, regardless of library permissions (API version 17.0 and later).
* All Salesforce Files they own, posted on their profile, posted on groups they can see, and shared directly with them (API version 21.0 and later).

You can obtain all ContentVersion data by using the Scheduled Data Export feature with the export attachments feature turned on.

  • 1
    In addition, I found this as well- "Depending on how files are shared, queries on ContentDocument and ContentVersion without specifying an ID won't return all files a user has access to. For example, if a user only has access to a file because they have access to a record that the file is shared with, the file won't be returned in a query such as "SELECT Id FROM ContentDocument." developer.salesforce.com/docs/atlas.en-us.api.meta/api/… – Ayub Apr 4 '18 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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