Access the parent of an item

Version: 10.4

You can use the Sitecore.Data.Items.Item.Parent property to access the parent of an item. For example, to access the parent item (/Sitecore/Content) of the /Sitecore/Content/Home item in the Master database:

RequestResponse
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item home = master.GetItem("/sitecore/content/home");
Sitecore.Data.Items.Item parent = home.Parent;

Do you have some feedback for us?

If you have suggestions for improving this article,