2
votes

I need to get an item from the "Archive" to see whether a particular item is in the archive (if its archived, notify the user its archived).

I have seen in an example in StackOverflow Get Items from Archive uses Sitecore.Data.Archiving.SqlArchive.GetEntries method. But I don't get the GetEntries method under Sitecore.Data.Archiving.SqlArchive.

I am using Sitecore 6.6. Is this method not available in 6.6? Is there any other way I can query the Sitecore Archive?

1

1 Answers

3
votes

To access the archives from the current database use:

Sitecore.Context.Database.Archives["archive"]
Sitecore.Context.Database.Archives["recyclebin"]

There are 3 methods that should be sufficient to get anything from the archives:

Sitecore.Context.Database.Archives["archive"].GetArchivalId(itemId)
Sitecore.Context.Database.Archives["archive"].GetEntries(archivalId)
Sitecore.Context.Database.Archives["archive"].GetEntriesForUser(user, pageIndex, pageSize)