Hi,
I’m working with Exchange mail client. While I’m filtering mail by To.Address field it doesn’t work.
Filtering by To.DisplayName - works fine.
In addition, I have the same problem while I’m filtering by From fields but in the opposite:
While I’m filtering mail by From.Address field it works well.
Filtering by From.DisplayName - doesn’t work.
Here below my snippet code:
Creating Query:
MailQuery mq = null;
ExchangeQueryBuilder qb = new ExchangeQueryBuilder();
qb.Or(qb.From.Contains(pFromAddress), qb.From.Contains(pFromName));
qb.To.Contains(pTo);
mq = qb.GetQuery();
return mq;
Create mail client:
NetworkCredential credentials = new NetworkCredential(UserName, Password, Domain);
IEWSClient MailClient = EWSClient.GetEWSClient(ServerHost, credentials);
Get mails by query:
MailClient.ListMessages(pSubfolderUri, pMaxResult, pMailQuery); --> this line returns 0 mails count although there is a mail matched to query.
Note that if I’m testing this code while I’m using IMAP server - I got results.
Additional info:
Working with Aspose.Email version 19.6.0.0
I tried it on IMAP server in office365 - https://outlook.office365.com/EWS/Exchange.asmx
Unfortunately, I can’t attach user & password to tested mail.
Thanks,
Naomi.