Always sort by IMAP uid desc

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2093 3d1905a2-6b24-0410-a738-b14d5a86fcbd
master
mguessan 2013-04-23 08:32:13 +00:00
parent 3f79bba608
commit 80eb32616e
2 changed files with 2 additions and 0 deletions

View File

@ -2166,6 +2166,7 @@ public class DavExchangeSession extends ExchangeSession {
searchRequest.append(" WHERE ");
condition.appendTo(searchRequest);
}
searchRequest.append(" ORDER BY ").append(Field.getRequestPropertyString("imapUid")).append(" DESC");
DavGatewayTray.debug(new BundleMessage("LOG_SEARCH_QUERY", searchRequest));
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executeSearchMethod(
httpClient, encodeAndFixUrl(folderUrl), searchRequest.toString(), maxCount);

View File

@ -695,6 +695,7 @@ public class EwsExchangeSession extends ExchangeSession {
if (condition != null && !condition.isEmpty()) {
findItemMethod.setSearchExpression((SearchExpression) condition);
}
findItemMethod.setFieldOrder(new FieldOrder(Field.get("imapUid"), FieldOrder.Order.Descending));
executeMethod(findItemMethod);
results.addAll(findItemMethod.getResponseItems());
offset = results.size();