0

I want to collect all the documents owned by each User in Salesforce account.

I have created accessToken with User A's email, where User A is a System Admin with property PermissionsModifyAllData and PermissionsViewAllData is true.

For User A we get all docs for which he is owner of but for all other users we get docs in which User A is a shared permisison by directly shared or with Domain shared i.e. when trying to query docs for let say User B we are not able to get docs in which User B is owner but it is not shared with User A.

I am using below SOQL with accessToken created with User A's login.

https://testdomain.salesforce.com/services/data/v48.0/queryAll?q=select Id, Title, Description, ContentSize, isDeleted, OwnerId, ParentId, LastModifiedDate, LastModifiedById, CreatedDate, FileType, FileExtension, PublishStatus from ContentDocument where OwnerId = '005XXXX000XXXX00XX'

Any lead to solve this usecase will be much appreciated.

0

By Adding QueryAllFiles Permisison to the Profile which User belongs to I am able to fetch all other user's documents as well. It was mentioned in the salesforce document as well which I missed at the first time.

Enable the Query All Files permission to let your View All Data users bypass the restrictions on querying files. Query All Files returns all files, including files in non-member libraries and files in unlisted groups. Users can’t edit, upload new versions, or delete files they don’t have access to. View All Data permission is required to enable Query All Files.

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.