I have a list of FeedItems I am iterating over. These are FeedItems for a List of Contacts that represent posts to their walls.
Some of these posts are of type ContentPost, which basically means someone posts a file to their wall. In the standard SFDC Chatter feed, this comes with a nice shiny icon and a link to the file.
From researching, I found out that the only way to get the id of the file is to use the ContentDocumentLink object, where the LinkedEntityId is the id of the contact.. I constructed the following query:
List<ContentDocumentLink> cdls = [Select ContentDocumentId, LinkedEntityId from ContentDocumentLink where LinkedEntityId = in :contactIds];
But got the following error:
Implementation restriction: ContentDocumentLink requires a filter by a single Id, ContentDocumentId or LinkedEntityId using the equals operator.
I tried with a hardcoded contact and it worked just fine.
The only solution I can think of is doing an SOQL query for every Contact that is in my List, which runs into limits issues. If this is the case, then Salesforce really didn't think through the ContentDocumentLink object very well. I would like to know if there are any alternatives before going down the 1 SOQL per Contact route.
Thanks in advance.