Administrator users are unable to query all ContentNote and ContentDocument objects using SOQL or Apex. The query returns only records owned by the running user, even when the user's profile includes the 'View All Data' (VAD) system permission. This occurs because ContentNote and ContentDocument follow a separate file-sharing model in Salesforce, where VAD does not override file visibility. The 'Query All Files' permission must be explicitly enabled to allow querying all files regardless of ownership.
Enable the "Query All Files" permission for the Salesforce System Admin profile. Unless this option is enabled, you can only query records that you own even if you have View All Data.
1. Set Up > Permission Set > New.
2. Enter the preferred details.
3. Click Save.
4. Click App Permissions.
5. Click Edit,
6. Navigate to "Query All Files".
7. Check the "Query All Files" checkbox.
8. Click Save.
9. After that, click Manage Assignments.
10. Click Add Assignments.
11. Check all Users you want to add, then click Assign.
000395050

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.