Free Support Forum - aspose.com

IEWSClient listMessages returns empty collection

Using Aspose.Email for Java version 20.3 I am trying to list the messages from a inbox with the following code:

ExchangeMessageInfoCollection messages = client.listMessages(client.getMailboxInfo().getInboxUri());

The collection is empty however in the inbox are 4 unread mails.
When I list the messages with a query like this I do get the messages.

ExchangeQueryBuilder builder = new ExchangeQueryBuilder();
builder.hasNoFlags(ExchangeMessageFlag.IsRead);
MailQuery query = builder.getQuery();

ExchangeMessageInfoCollection messages = client.listMessages(client.getMailboxInfo().getInboxUri(), query);

I find it strange that when using no query I don’t get any messages. Am I doing something wrong? I am not interested in the mails being read or unread I just want all the messages.

@bascouwenberg,

I have observed the issue shared by you and in order to investigate the issue further on our end we request you to please share the test account credentials, output obtained and used sample code that we may try on our end to help you further.