Hi there,
I'm encountering an issue while trying to fetch the last 10 emails from a folder. Despite fetching only the last 10 emails, the results I receive seem to be sorted with mixed dates. Loading all emails and sorting them afterwards isn't an ideal solution due to performance constraints.
I've implemented a solution that relies on server-side sorting, which works well, but unfortunately, it's not supported by all mail servers.
Here's the code snippet that works only when the server supports server-side sorting:
List<long> uids = client.Search()
.Where(Expression.Subject("subject"))
.Sort(SortBy.Multiple(
SortBy.Reverse(SortBy.Date()),
SortBy.Subject()
))
Could you suggest an alternative approach that ensures the last 10 emails are fetched and sorted by date, without relying on server-side sorting?