Rename an item

Version: 10.4

You can use the Sitecore.Data.Items.Item.Name property to rename an item. For example, to rename the /Sitecore/Content/Home/Sample item in the Master database to /Sitecore/Content/Home/Changed:

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

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

sample.Editing.BeginEdit();

sample.Name = "Changed";

sample.Editing.EndEdit();

Do you have some feedback for us?

If you have suggestions for improving this article,