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
Chad JoubertChad Joubert 

Get all ContentDocuments for a given Entity through SOQL

I am looking to get several fields from the ContentDocuments object given an entity Id for the ContentDocuemntLink.  The SOQLthat I am trying is: Select Title, ContentModifiedDate, ContentSize from ContentDocument 
where Id IN (SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '00655000007PiSd') but I get the error:

(SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId
                                                        ^
ERROR at Row:2:Column:44
Entity 'ContentDocumentLink' is not supported for semi join inner selects

I need this in SOQL because the call is coming from a .Net program.  I can accomplish this will a second call but would like to be able to get the list in one call.
 
JLA.ovhJLA.ovh
You could start from the child relationship :
SELECT ContentDocumentId,ContentDocument.Title, ContentDocument.ContentModifiedDate, ContentDocument.ContentSize FROM ContentDocumentLink WHERE LinkedEntityId = '00655000007PiSd'