Free Support Forum - aspose.com

Not able to querymessages using ListMessages anymore (since 20.4)

Hi,

Ever since I’ve upgraded to Aspose.NET 20.4 EWSClient.ListMessages with query ability doesn’t return messages.
I tried going back to Aspose.NET 20.3 and it works but then I ran into problems running IMAP client on .net core 3.1 (EMAILNET-39791 was fixed in version 20.4)
I feel like i’m really caught between a rock and a hard place here and will appreciate your help in understanding what was changed in 20.4.

This is a snippet example of code that returns messages in 20.3 but not returning anything in 20.4.

            // Connect to EWS
        const string mailboxUri = "https://outlook.office365.com/ews/exchange.asmx";
        const string username = "--REDUCTED--";
        const string password = "--REDUCTED--";
        const string domain = "--REDUCTED--";

        try
        {
            IEWSClient client = EWSClient.GetEWSClient(mailboxUri, username, password, domain);

            // ExStart:CaseSensitiveEmailsFiltering
            // Query building by means of ExchangeQueryBuilder class
            ExchangeQueryBuilder builder = new ExchangeQueryBuilder();                
            builder.HasFlags(ExchangeMessageFlag.IsRead);
            MailQuery query = builder.GetQuery();
            // ExEnd:CaseSensitiveEmailsFiltering

            // Get list of messages
            ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.RootUri, 100, query, true);
            Console.WriteLine("EWS: " + messages.Count + " message(s) found.");

            // Disconnect from EWS
            client.Dispose();                
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }

Thanks in advance!

@eyaldar,

We are sorry for your inconvenience. I have observed the issue shared by you and like to share that Aspose.Email for .NET has no issue while using it in NET Core 3.1 environment. Can you please provide the sample project along with test account credentials for investigation on our end.

Hi,

Attached is an example project.
the mailbox has 2 mails - 1 read and 1 unread.
this code return 0 mails instead of 1, but if i remove the query returns all the mails.
CSharp.zip (3.7 KB)

@eyaldar,

I have observed the issue shared by you and have created a ticket with ID EMAILNET-39815 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thank you @mudassir.fayyaz, would it be possible to get any timeline for this fix? I can’t actually release an application with a sporadically crashing process nor with EWS not working at all…

@eyaldar,

The issue has just been added in our issue tracking system and I request for you to please be patient and we will share good news with you as soon as issue will be fixed.

The issues you have found earlier (filed as EMAILNET-39815) have been fixed in this update.