Copy an item and its descendants

Version:

You can use the Sitecore.Data.Items.Item.CopyTo method to copy an item and its descendants. For example, to copy the /Sitecore/Content/Home item and any descendants in the Master database to create /Sitecore/Content/Sibling:

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

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

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

home.CopyTo(content,"Sibling");
If you have suggestions for improving this article, let us know!