I am looking to use the following query to bulk query all the notes and attachments in an org(or by object) so that I can do the migration of N&A's to Files (pre Spring '16 N&A's). Can someone give me a hand with this?
SELECT ContentDocumentId,Id,LinkedEntityId,ShareType FROM ContentDocumentLink WHERE LinkedEntityId = 'YourRecordId'
I am planning to run the code in Anon window and review the results
Your time and thoughts on this are much appreciated
I don't know if there is a limit to the size of the Set variable, but I think there is a way to set all the target linked object Ids.
The resulting List variable has a LinkedEntityId field so you can identify the object that contains the file.
List<Account> accList = [SELECT Id FROM Account];
SET<Id> IdSet = new SET<Id>();
for (Account acc : accList) {
IdSet.add(acc.Id);
}
List<ContentDocumentLink> ContentDocumentLinkList = [SELECT ContentDocumentId,Id,LinkedEntityId,ShareType FROM ContentDocumentLink WHERE LinkedEntityId =: IdSet];