0

I want to archive Sitecore item version and not the entire item using Powershell script.

I could not find the way to archive version, articles are there to archive item but not the specific version. Also could not find the command in PowerShell documentation. https://doc.sitecorepowershell.com/

I tried ArchiveItem($item) but it archives the entire item and not the version alone.

Can some one guide me to find the solution on this query?

Thanks,

0

1 Answer 1

0

Yes, it is possible through Sitecore Powershell script. Write your logic like this.

# get item to archive and provide the version. Examle 3

$item = Get-Item -Path "master:" -Uri "sitecore://master/{6151ACBE-40C3-45D5-BCE8-5E939C461C12}?lang=en&ver=3"

[Sitecore.Data.Archiving.ArchiveManager]::GetArchives($item.Database)

$archive = [Sitecore.Data.Archiving.ArchiveManager]::GetArchive("archive", $item.Database)

$archive.ArchiveVersion($item)

$archive.GetEntries(0,10)

Now when you go to the Archive window, you will see the version you have archived.

enter image description here

4
  • Would be better to add this answer to the existing question and this question be closed. Jul 8, 2022 at 13:55
  • @MichaelWest Can you please share the link of the existing question ? Jul 8, 2022 at 13:57
  • @kapil Does this answer your question? Jul 9, 2022 at 5:04
  • Yes Sumit, This solve my problem. Thanks
    – Kapil
    Jul 14, 2022 at 9:55

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