function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Greg CooganGreg Coogan 

Querying ContentNote Doesn't Return Notes By Other Users

I am querying against the ContentNote object using the Developer Console. I am using the administrator account to query, which has the Modify All Data permission. However, I return no results from that table even though my users have many Notes. How can I query the IDs of everyone's notes? Are they hidden from me? The query did return a few records before I deleted my Notes, so I know the query is correct.

Query:
SELECT Id FROM ContentNote
Best Answer chosen by Greg Coogan
Dushyant SonwarDushyant Sonwar
Private library cannot be accessed by System Admin .Private library files can only be Accessed by library owner.
If Library is shared ,then it also be a member of library with permission defined in the url mentioned in last reply above.

Thanks,

All Answers

Dushyant SonwarDushyant Sonwar
Hi Greg,

Did you check that the current user has salesforce crm Content User Permission?
Thanks,
Greg CooganGreg Coogan
Dushyant, That permission is checked.
Dushyant SonwarDushyant Sonwar

Hi Greg,

Could you also look at ,that the user is member of that content library?
you can verify the permission which is mentioned in the below url.I have also faced this problem and mine was resolved by following url.May be it can resolve yours.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm

 

Thanks,

 

 

Greg CooganGreg Coogan

In your first reply, when you said "current user," did you mean the system admin user I was currently logged in as or the user's Notes I was trying to delete?

Dushyant SonwarDushyant Sonwar
Greg  ,yes , I was referering to the current logged-in user.
Greg CooganGreg Coogan
I am trying to delete Notes, as well as Documents, that were created typically by attaching documents or creating notes on Events, and other records. I am not sure if adding these files when viewing an Event would result in the files being adding to any particular content library. Please note that we are using Lightning.

Is that URL supposed to show how to check if my admin account is a member of that content library, which is likely the private library owned by that user whose files I am trying to delete.
Dushyant SonwarDushyant Sonwar
Private library cannot be accessed by System Admin .Private library files can only be Accessed by library owner.
If Library is shared ,then it also be a member of library with permission defined in the url mentioned in last reply above.

Thanks,
This was selected as the best answer
Greg CooganGreg Coogan
I ended up having to log in to each user's account in dataloader.io to export the IDs I needed of their documents. Thanks for your help!
Deepak BalakrishnaDeepak Balakrishna

@Greg Coogan,
I am also having same use case Is there a way in salesforce using soql where we can get documents owned by other users but not necessarily shared to me?

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.