function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShreyankaShreyanka 

Apex code to delete files in salesforce

I tried to delete files directly from the content details page, I'm getting an error: "This document is awaiting archival. Cannot delete the file at this time. Please try again later".

Anyone, please share the apex code that deletes content files from salesforce.

Thanks in advance.
Suraj Tripathi 47Suraj Tripathi 47
Hi Shreya,
Please go through the below link -

https://www.salesforcecodecrack.com/2020/02/delete-files-from-library-using-apex.html

Please mark it as the best answer, if it helps.
Thanks
ShreyankaShreyanka
Hi Suraj,
I tried executing the code which you've sent, the code is error-free but it's not deleting the files.

Do you have any idea why it's not performing the deletion?

Thanks