Move an item

Version:

You can use the Sitecore.Data.Items.Item.MoveTo method to move an item or branch. For example, to move the /Sitecore/Content/Home/Sample item in the Master database to /Sitecore/Content:

Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");

Sitecore.Data.Items.Item sample = master.GetItem("/sitecore/content/home/sample");

Sitecore.Data.Items.Item content = master.GetItem(Sitecore.ItemIDs.ContentRoot);

sample.MoveTo(content);
If you have suggestions for improving this article, let us know!