It should work to sort by StartPublish. I guess you know you have to use "PageStartPublish"?
new FilterPropertySort("PageStartPublish", FilterSortDirection.Descending).Filter(pagesToSort);
Personally I use LINQ when sorting nowadays, especially when using PageTypeBuilder.
Thanks Erik - I'll give it another try using "PageStartPublish" as I think I was just using "StartPublish" - I am using PTB but this code is part of search behind a webserivce so im trying to keep it as effiecnt as possible for big PageDataCollections.
Erik - that was it! Very annoying - seems if you pass a propery name that doesnt exist, some other form of sorting occurs - would a null reference exception or similar was thrown.
Any how, I can confirm it works correctly with String, Date and Int fields (so I guess it should work with any other type that is comparable)
Thanks
.. because currently (CMS6 R2) I dont think it is. I have been using this filter to sort a PageDataCollection by StartPublish Descending (to get most recent pages at the start of the list) and the ordering is completly wrong. Further more I noticed that if you call the Filter method a couple of times, the ordering is changed each time! (Surely once something has been sorted, re-sorting it should not change anything).
I've solved the problem by creating my over version of the filter which works with DateTime (or PropertyDate) property types.
It would appear that this filter only works with string values but no mention of that is said in the SDK (http://sdk.episerver.com/library/cms6.1/html/T_EPiServer_Filters_FilterPropertySort.htm)
So my question is - Is this by design? I'm supprised to not find any mention of this in the forums or blogs? are people generally not using this filter for sorting (favouring custom filters or linq?)
Thanks
Adam