I got a chatter group,which i am not a member of .

I got this code below

list<ContentVersion > to = [select Title, FileType, ContentSize ,contentdocumentid,VersionNumber from ContentVersion where id ='069M0000000JyUx' ];

This chatterfile is present in this chatter group which i am not part of.But i am running the code as system admin.and also when i go to the file,via url, i can see it and even download it from the link.

But when i run this code,i don't get any row back from Contentversion. am i looking at wrong tables?

2 Answers 2


The documentation says

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 Chatter files they own, posted on their profile, posted on groups they can see, and shared directly with them (API version 21.0 and later).


Tried the below code as a user not in any group but was not succesfull when I added the user it is working fine public without sharing class testContent {

    public testContent()
        list<ContentVersion > to = [select Title, FileType, ContentSize ,contentdocumentid,VersionNumber from ContentVersion where ContentDocumentId =:'06990000000xZSK'  ];


Take a look at the Content Objects ERD.

I think you are passing the ID of the ContentDocument and not the ContentVersion as the parameter in the where clause.

Try this:

List<ContentVersion > to = [
    Select Id, Title, FileType, ContentSize ,
    From ContentVersion 
    Where ContentDocumentId = '069M0000000JyUx'
  • no that doesnt work as well.for the file i am shared with,i can get result back in query(even my other query)..but once i change file settings back to 'not shared' it doesnt work
    – sfdc99999
    Commented Nov 29, 2013 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .