*/
public GWTMessageList retrieveMessages( String folderId, int start, int pageSize, MessageListFields sortField,
boolean ascending, MessageListFields[] searchFields, String[] searchValues ) throws Exception {
if ( folderId != null ) {
IMailbox mailbox = SessionManager.get().getMailbox();
UserAccount account = SessionManager.get().getUserAccount();
log.debug( "retrieving messages from " + folderId + " ..." );
try {
IMailFolder currentFolder = mailbox.getMailFolderById( folderId );
if ( currentFolder == null ) {
mailbox.reloadFolder();
currentFolder = mailbox.getMailFolderById( folderId );
}
mailbox.setCurrentFolder( currentFolder );
Message[] msgs = currentFolder.retrieveMessages( sortField, ascending, searchFields, searchValues );
if ( msgs != null && msgs.length > 0 ) {
int total_count = msgs.length;