1

SOQL:

[SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = {{reocrdID}}]

OR

SELECT Id, (SELECT ContentDocumentId FROM ContentDocumentLinks) FROM {{sObjectAPIName}} Where id = {{recordID}}

On Anonymous window: returns list of files attached with particular record

On Internal VF page controller (without sharing): returns list of files attached with particular record

On Site VF page controller (without sharing): returns empty list

Is there any configuration/access permission needs to be granted for site guest user?

0

I think that queries directly on Content are picky and don't always display everything other users own, even if it's visible to the user by permissions or by way of without sharing.

Perhaps you can try querying the record instead, and subquerying its ContentDocumentLinks list?

3
  • Thanks Charles! But only available link between ContentDocument and LinkedEntity is ContentDocumentLink record. As per my understanding, there is no other option.
    – sfdcnoob
    Nov 30 '18 at 5:21
  • Yes but what I'm saying is, query it parent-to-child instead. For example if it's an Account, SELECT Id, (SELECT ContentDocumentId FROM ContentDocumentLinks) FROM Account WHERE Id = :acctId.
    – Charles T
    Nov 30 '18 at 5:38
  • Hi Charles, Thanks for inputs! Tried it, still empty result. Same results as mentioned in question.
    – sfdcnoob
    Nov 30 '18 at 6:31

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.