I'm trying to display all the files of all the Groups to which a user belongs to.
i.e, if the user is a member of GroupA and GroupB, then I have to display all the files which belong to GroupA and all the files which belong to GroupB.
This is similar to 'FILES IN MY GROUPS' section in the standard Files tab.
Currently I am trying to use the 'ContentDocumentLink' object as shown below:
select Id, ContentDocument.title, ContentDocument.LastViewedDate, ContentDocumentId, ContentDocument.LastModifiedDate from ContentDocumentLink where LinkedEntityId =:groupId
Using the above query I can get all the files which belong to the group referred by the groupId variable.
When I try to query by giving a set of ids for 'LinkedEntityId' field in the where condition, then I'm getting an error saying that only a single id, ContentDocumentid or LinkedEntityId should be used with an equals operator.
Is there any other object that can be used for this? Or should the above query be changed? So how can I get a list of documents which belong to a list of groups? Need some help on this please.