codeflood logo

Archive and Recycle bin in Crestone

One of the big changes in Crestone is the reduced number of databases. We now only have 3 by default instead of 7. The extranet and security databases have been removed due to the use of ASP.NET security, and the recycle bin and archive databases are also AWOL. Sitecore considers both recycle bin and archive to be archives of the source database. This is evident in web.config. If you go and have a look at the database definitions in the <databases\> element you’ll see the archives tag where the archives are added for the current database. This is not new. 5.3.x also had this structure, although instead of merely defining an archive exists by name for the current database, a reference to an external archive was made. Not so in Crestone. This is because each database can contain it’s own set of archives. So if I delete an item in the core database, it doesn’t end up with the deleted items from the master database. They are kept separate in their own database specific archives. Programmatically we can query what archives a database has by accessing the ArchiveNames property of the database.


We can retrieve an archive by accessing the Archives property of the database as follows.

Sitecore.Context.Database.Archives["recycle bin"]

This then returns an object of type Sitecore.Data.Archiving.Archive. This class can be used to query the list of items in the archive. The structure of the items returned through this class is flat. You get back a generic list of ArchiveItems. The methods provided on this class to retrieve items are already setup to provide paging and filtering as well as other archive activities such as the archiving of items.


Hey, neat observation. I knew that we had moved the archive and recycle bin into the databases, but have not had time to play around with it.
Very nice.

Comments are closed


Leave a comment

All fields are required.