public string GetItemUrl(ICmObject item) { var options = LinkManager.GetDefaultUrlOptions(); options.Language = item.Language; options.Site = Sitecore.Context.Site; return LinkManager.GetItemUrl(item.InnerItem, options); }
public IEnumerableThis code example demonstrates how to use the ICmObject interface to retrieve an item's children. The InnerItem property of the interface returns the Sitecore Item object that can be used to get the children. The Sitecore.Data.Items.Item class is part of the Sitecore.Kernel package library. In summary, ICmObject is an interface in the Sitecore CMS that provides methods and properties to interact with items or content elements on a website. The interface is usually used in conjunction with other Sitecore API classes and packages, such as the Sitecore.Links and Sitecore.Kernel libraries.GetChildren(ICmObject item) { Item item = item.InnerItem; return item.Children.Select(c => new SitecoreDataItem(c)).Cast (); }