To keep it simple, I want to know to which Objects are linked my Attachments, so I executed the following SOQL query :
select count(id), Parent.type counter from Attachment
group by Parent.type
I get the result I want with the count for each object.
My problem now is I want to do the Same for ContentDocument/ContentVersion I know to do it for a specific object I would do :
SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN (SELECT Id FROM Account)
And I will get the count for Account. Thing is I want to know for all objects because my goal is to know how many Document are linkes to each object and have an overview, so I cannot list myself each objects in salesforce to find it. Is there a way to do that in one go ? This would not work : SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink
Because I get Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator.
Maybe with APEX ?
Edit : The QueryAll document followed with this query did the trick :
SELECT COUNT(Id), LinkedEntity.type
FROM ContentDocumentLink
GROUP BY LinkedEntity.type