3

I need to archive Sitecore items using Sitecore PowerShell. Any commnand that can be used to achieve this.?

1
# get item to archive
$item = Get-Item -Path '/sitecore/content/ITEM'

# see available archives for current database
[Sitecore.Data.Archiving.ArchiveManager]::GetArchives($item.Database)

# select archive that you want to use
$archive = [Sitecore.Data.Archiving.ArchiveManager]::GetArchive("archive",$item.Database)

# store an item in the archive
$archive.ArchiveItem($item)

# browse archive entries
$archive.GetEntries(0,10)

To get more useful function for Archive object see this class Sitecore.Data.Archiving.Archive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.