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
Andrey BosakAndrey Bosak 

Chatter Files are not visible by query

Hi!

I have 2 users. I want to create chatter file using insert ContentVersion with Origin=H; from the first user and access it from the second user using query. The problem is that I can see uploaded file in Files tab from both users, but cannot access it using query only from owner user. Do anybody know how to solve this? 

Thank you

NagaNaga (Salesforce Developers) 
Hi Andrey,

Let me know if this SOQL query helps


SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '[RECORD ID]'

Please follow the link below for more info

http://salesforce.stackexchange.com/questions/564/how-to-query-all-chatter-files-attached-to-a-record

Please let me know if this was useful

Best Regards
Naga Kiran
 
Andrey BosakAndrey Bosak

Hi Naga, 

Thank you for your answer, but no, this query and article didn't help to solve my problem. This queries have returned an empty list

1508.mishra1508.mishra
Try this
Select c.VersionData, c.Id, c.FileType, c.ContentLocation, c.ContentDocumentId From ContentVersion c where c.Id = 'Chatter file ID'
 
GennadiyGennadiy
Hi Andrey.

Have you found any solution, workaround or explanation for this issue?

I'm facing the same problem. According to my research, an admin with the "See All Data" permission may see private files in UI (on the Files tab), but such files are not available for him via SOQL-query to ContentVersion object. So, it looks like Salesforce uses some kind of internal magic to get more data for standard pages than we can get in custom code.