Get Sitecore Items sorted by created date
In this article we will learn how to sort sitecore items by creation date.
suppose you want to get items which created recently then you can set sort order in your c# code and get latest items.
you have to just add single line of code to achieve.
Sitecore.Data.Database current = Sitecore.Context.Database;
Item getItem = current.GetItem(pass your folder id);
IEnumerable<Item> allItems = getItem.GetChildren().OrderByDescending(sort => sort.Created)
you can put where condition to filter items for specific field. means you can manage code according to your requirement..
Happy Coding😊
Comments
Post a Comment