If you have to delete any library, then first you have to delete all the files present in that library. For this purpose you can run below mentioned simple apex script to delete all files from library.
string LibraryName='Demo Library';
ContentWorkspace ws = [SELECT Id, RootContentFolderId FROM ContentWorkspace WHERE Name = :LibraryName LIMIT 1];
List<ContentDocument> contentDocumentIds = new List<ContentDocument>();
for(ContentDocumentLink con:[select id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where LinkedEntityId=:ws.Id]){
contentDocumentIds.add(new ContentDocument(id=con.ContentDocumentId));
}
system.debug('********contentDocumentIds:'+contentDocumentIds);
system.debug('********contentDocumentIds.size:'+contentDocumentIds.size());
database.delete(contentDocumentIds,false);
Hope this will help!!
string LibraryName='Demo Library';
ContentWorkspace ws = [SELECT Id, RootContentFolderId FROM ContentWorkspace WHERE Name = :LibraryName LIMIT 1];
List<ContentDocument> contentDocumentIds = new List<ContentDocument>();
for(ContentDocumentLink con:[select id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where LinkedEntityId=:ws.Id]){
contentDocumentIds.add(new ContentDocument(id=con.ContentDocumentId));
}
system.debug('********contentDocumentIds:'+contentDocumentIds);
system.debug('********contentDocumentIds.size:'+contentDocumentIds.size());
database.delete(contentDocumentIds,false);
Hope this will help!!
assad
ReplyDeletesuper artical
ReplyDeletezoho aptitude questions
zoho aptitude questions 2019 pdf
zoho c aptitude questions with answers
c aptitude questions for zoho
zoho aptitude questions with answers
zoho c aptitude questions with answers pdf
zoho aptitude questions 2017 pdf
zoho digital marketing aptitude questions
zoho aptitude questions 2018 pdf
zoho technical support aptitude questions
Super article
ReplyDeleteWhat is Cyber Security
Types of Cyber Attacks
Types of Cyber Attackers
Cyber Security Technology
Cyber Security Tools
Cyber Security Standards
What is Google Adwords
Google Adwords tutorial
Google Keyword Planner
How to Advertise on Google
They can't depend on traditional file transfer strategies like email, messenger administration and FTP when the files are an excessive number of and excessively enormous and should be sent at the earliest opportunity.transfer files
ReplyDeleteThanks for sharing such a great blog......!!!
ReplyDeletefull form
full form of nrc
nrc full form
mbbs full form
full form of rip
Twitter Promotion is a great way to have this blog seen but if you have videos you can also buy tiktok views and more !
ReplyDeleteYouTube Promotion seems a great way to have your videos seen but you can also buy slow instagram likes as well for your photos to receive daily traffic.
ReplyDeleteDo you need Finance? Are you looking for Finance? Are you looking for finance to enlarge your business? We help individuals and companies to obtain finance for business expanding and to setup a new business ranging any amount. Get finance at affordable interest rate of 3%, Do you need this finance for business and to clear your bills? Then send us an email now for more information contact us now via (financialserviceoffer876@gmail.com) whats-App +918929509036 Dr James Eric Finance Pvt Ltd Thanks
ReplyDeleteYou can try File ZIPO, a native appexchange application that can help you to Zip multiple Salesforce files & attachments from the Salesforce org and download them in: Single folder or Multiple folder (Parent / Child Structure)
ReplyDeletehere's link - Zip Salesforce Files