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

Can we restore an archived content using APEX?

I know we can archive a content document by setting the isArchived field in the ContentDocument object.

However once that document is archived that record disappears from the ContentDocument object.


for e.g If I contribute a document/image file by uploading it to any library  .

The following query will bring 1 record.

 Select c.Title, c.PublishStatus, c.ParentId, c.IsArchived, c.Id, c.ArchivedDate, c.ArchivedById From ContentDocument c


now If I archive thie document either from UI or programatically the same query doesnot fetch any records.


Is there any way to fetch this record using SOQL and set the IsArchived flag back to False?




Hi Rahul,


If u got any solutions. Please share with me .. i am also facing the same problem :(




You are able to retrieve content using the ALL ROWS qualifier at the end of your query. From the UI, you'll have to go to the library and click the button to view archived content