I am loading items through the Dynamicweb.Content.Items api. Working fine and I can sort on different fields.
My issue is I can not figure out how to sort on “user defined” order as set in the dw backend.
Here is a code sample trying to sort on user-defined which does not work :(
ItemManager.Initialize();
using (Repository repository = ItemManager.Storage.Open("Brochure_Detail"))
{
Query query = new Query();
query.Fields = new List
query.OrderBy = new OrderByCollection();
query.OrderBy.Add(new OrderBy("UserDefined", OrderByDirection.Ascending));
query.Offset = 0;
query.Amount = 1000;
var AllItems = repository.SelectByParentPageId(2339, query, false, false, false);
foreach (var item in AllItems)
{
//do stuff with item in user defined order :)
}
}
Who can tell how to achieve this?