Archive and Recycle bin in Crestone

1

June 17, 2008 by Alistair Deneys

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.

Sitecore.Context.Database.ArchiveNames

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.

Advertisements

One thought on “Archive and Recycle bin in Crestone

  1. Lars Nielsen says:

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

The views expressed on this blog are solely my own and do not necessarily reflect the views of my employer.
%d bloggers like this: