Extending LibraryManager.DataClasses.LibraryData sorting using LINQ

  • Updated

The Legacy Ektron.Cms.API.Library is replaced by Ektron.Cms.API.LibraryManger() in the current CMS version
The LibraryManger() uses a LibraryCriteria.AddFilter(...). The sort is limited by the LibraryCriteria.AddFilter use of LibraryProperty. This has a limited set of values.    The retrieved Data is collected in a libraryDataList. This contains column names.

The LibraryManger() uses a LibraryCriteria.AddFilter(...)
The LibraryProperty  contains a limited set  properties for sorting.

Populating a new DataList sorted by any libraryDataList.Columname extends sorting when managed as follows:
Instantiate a DataList. Apply LINQ , coding to sortBy any of the column Names, to the libraryDataList
assigning the sorted libraryDataList results to the new instantiated  DataList.

This is the output Code Sample:
var DataList = (from ifile in libraryDataList
                orderby ifile .Title descending
                select ifile).ToList();