Wednesday, 13 June 2018

Moving Archived items from one Sitecore instance to another


In continuation to my previous posts I will be sharing some steps in which we can package up the Archived items and move them from one Sitecore instance to another.
This can be a requirement for many migration projects.

Note: We can only create a package for items which are in content tree(i.e non Archived/deleted).

Following are the steps we can follow to move archived items:
1. Get list of all archived items from source instance master DB. (programmatically)
2. Restore the list of archived items from step 1 to the source instance. (programmatically)
3. Create Sitecore items package of the restored items. (programmatically)
4. Archive the restored items again on source instance DB. (programmatically)
5. Grab the sitecore package created in step 3 above and install it on the destination instance.
6. Read items from the package and archive them.

Saturday, 2 June 2018

How to Archive and Restore Sitecore Items programmatically

Content Author can archive items any time from Sitecore client by using Archive button in the Review tab.


And later can restore the archived items form the Archive application.


However, we can have a situation where we need to archive or restore items based on some action.
Following is the code which can be used to archive items programmatically: