Issue with MailQueryBuilder.To field

Hi,

I am trying to filter messages on Exchange 2013
Given :
Exchange folder contains one message sent to address ‘someRcp@gmail.com’ with subject ‘TestMail’, sent 3/Jun/2016

my code looks like this:

string folderUri;
//initialize proper value for folderUri;

MailQueryBuilder qb = new MailQueryBuilder();
//…
//initiale qb fields;
//…
IEWSClient.ListMessages(folderUri, qb.GetQuery());

when qb.GetQuery().ToString() equals :
"((‘Subject’ Contains ‘test’)&(‘InternalDate’ >= ‘1-Jun-2016’))“
I do receive that mail message from folder as a result;

when qb.GetQuery().ToString() equals:
”((‘To’ Contains ‘someRcp@gmail.com’)&(‘Subject’ Contains ‘test’)&(‘InternalDate’ >= ‘1-Jun-2016’))“
as well when qb.GetQuery().ToString() equals :
”(‘To’ Contains ‘someRcp@gmail.com’)"
I do receive empty result;

Please help me to resolve this issue

Hi George,

Thank you for writing to Aspose Support team.

We have tested this issue with our Exchange Server 2010 and the functionality works fine at our end. Can you please specify if this issue occurs in general with your sample email addresses or you are able to reproduce it for other emails as well? Please try sending few test emails to asposeemail.test3@aspose.com so that we can check the issue with your sample email and assist you further.

Hello Kashif,

I have tried using different e-mail addresses and different users on our Exchange 2013, and faced the same problem. You said, that you checked that on 2010, unfortunately I don’t have access to 2010 Exchange Server to check this code on different server;


This is the sample code that I execute
public int CountMessages(string from,
string to,
string subject,
string body,
DateTime? fromDate,
DateTime? toDate,
string subfolderName)
{
// MailClient is IEWSClient

if (MailClient != null)
{
string folderUri = MailClient.MailboxInfo.RootUri;
if (!string.IsNullOrEmpty(subfolderName))
{
string subfolderUri = GetSubFolderUri(subfolderName, false);
if (!string.IsNullOrEmpty(subfolderUri))
{
folderUri = subfolderUri;
}
}
MailQueryBuilder qb = new MailQueryBuilder();
if (!string.IsNullOrEmpty(from)) qb.From.Contains(from);
if (!string.IsNullOrEmpty(to)) qb.To.Contains(to);
if (!string.IsNullOrEmpty(subject)) qb.Subject.Contains(subject);
if (!string.IsNullOrEmpty(body)) qb.Body.Contains(body);
if (toDate != null && toDate.HasValue) qb.InternalDate.BeforeOrEqual(toDate.Value);
if (fromDate != null && fromDate.HasValue) qb.InternalDate.Since(fromDate.Value);
ExchangeMessageInfoCollection mails = MailClient.ListMessages(folderUri, qb.GetQuery());
return mails.Count;
}
return 0;
}

Thanks a lot for help

Hi George,

Thank you for sharing additional information.

We tested this with Office365 and were able to reproduce the same issue at our end. It has been logged as EMAILNET-35262 in our issue tracking system for further investigation by our Product team. We’ll update you here once there is some information or a fix version available in this regard.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.