This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Id LinkedEntityId = [SELECT Id FROM ContentWorkSpace WHERE Name = 'Asset Library' LIMIT 1].Id; | |
List<ContentDocumentLink> ContentDocumentLinkList =[SELECT ContentDocumentId, LinkedEntity.Name, LinkedEntityId, LinkedEntity.Type FROM ContentDocumentLink WHERE ContentDocumentId =:LinkedEntityId]; | |
List<Id> DocIdList = new List<Id>(); | |
for(ContentDocumentLink cdLink: ContentDocumentLinkList){ | |
DocIdList.add(cdLink.ContentDocumentId); | |
} | |
List<ContentDocument> ConDocList =[SELECT Id, CreatedBy.Name, ContentSize, ParentId FROM ContentDocument WHERE Id IN: DocIdList]; | |
delete ConDocList; |