I would like to get the Root Structure Group and then iterate through all immediate children of it using the Razor Mediator.
Getting the root StructureGroup works, but it is a StructureGroupModel object. Calling GetItems on this gives me an error.
Casting it to a StructureGroup object works, but calling GetItems on that also returns the same error about it being a property. GetListItems does work (see code), but then I need to supply the ItemType filter, and that is quite challenging.
Questions: Is it possible to iterate through the direct children of the Root StructureGroup in Razor? How would I declare an ItemType filter to only the Structure Groups?
@{
var rootSG = Publication.RootStructureGroup;
<div>@rootSG.GetType()</div>
var rootObject = TridionHelper.Engine.GetObject(rootSG.Id);
<div>@rootObject</div>
foreach (var sg in rootObject.GetListItems())
{
<div>@sg.OuterXml</div> @* this works.. *@
}
}