1

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' ];
system.debug(to);

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?

1

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).

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_contentversion.htm

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'  ];

    }
0

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 ,
        contentdocumentid,VersionNumber,IsLatest 
    From ContentVersion 
    Where ContentDocumentId = '069M0000000JyUx'
];
System.debug(to);
  • 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 Nov 29 '13 at 18:29

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.