Lets imagine for a second that you have a lot of content Authors, and they are creating new items every day. At some point in the future, these items need to be moved to an Archive. Out of the box Sitecore has a functionality of Archiving Items, but it all goes into the Archive Application that you can access from Desktop > All Applications > Archive

I would like to achieve something different, I would like to move items from News folder to News Archive folder, illustrated below:

Auto Archive in Sitecore

In order to achieve this, you will need to create a News Template with certain fields, see the screenshot below:

Template

So then you will create a News item based on the News Template you just created.

You should see something similar to the screenshot below:

news-item

After you have all the items created in Sitecore Content Editor, now lets go to the Visual Studio and write some code:

After you build and deploy the code, you will need to add some custom Configurations. So go ahead into the folder Website>App_Config>Include>Project>ItemMoving.config and insert the code below, this will patch the actual Sitecore.config

So this agent will execute every minute, and search for the Expiration Date within the items, that are in the News (Source Folder) and move the expired files to the News Archive (Destination folder). If you have any questions do not hesitate to ask.

Acknowledgement:
Richard Seal – https://sitecore.stackexchange.com/users/70/richard-seal
Dannon Gruver – https://www.linkedin.com/in/dannongruver
This blog post is based on the post from Stack Exchange:
https://sitecore.stackexchange.com/questions/5974/move-items-between-folders-programmatically
Note that this blog post has no intention to claim anybodies work as my own. This blog post is for informative purposes only.

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