1. Create a class and create a method with your required assess method.
protected Database Database
{
get
{
return Sitecore.Context.Database;
}
}
protected Item GetItem(Guid id)
{
if (Sitecore.Context.Item != null && Sitecore.Context.Item.ID.Guid.Equals(id))
{
return Sitecore.Context.Item;
}
else
{
return Database.GetItem(new ID(id));
}
}
2. Get the folder item
Guid folder_guid = new Guid("{Your-item-id}");
var folder_item = GetItem(folder_guid);
3. Loop through the items inside that folder
if (folder_item != null)
{
foreach (Item childItem in folder_item.Children)
{
//Do your logic with the childItem
}
}
No comments:
Post a Comment