ExchangeQueryBuilder InternalDate DateTime Problem

Hello Aspose team,

Using exchange mail 2013, Aspose.Mail.dll version 17.3.0.0
I am facing the following problem with datetime stamp.

Example:
I have a mail box with number of mails received in 01/01/2017
I would like to ListMessages only between 01/01/2017 14:00 and 01/01/2017 14:30.

I use following code to create MailQuery:

pToDate = new DateTime(01/01/2017 14:30);
pFromDate= new DateTime( 01/01/2017 14:00);

ExchangeQueryBuilder qb = new ExchangeQueryBuilder();
qb.InternalDate.BeforeOrEqual(pToDate.Value);
qb.InternalDate.Since(pFromDate.Value)
MailQuery mq = qb.GetQuery();

As a result if this code I have mq = {((‘InternalDate’ <= ‘1-Jan-2017’)&(‘InternalDate’ >= ‘1-Jan-2017’))}
When I use this query with IEWSClient.ListMessages I have unexpected result (all mails from 1 Jan returned instead of requested time slice).
Please help me to resolve this issue
Thanks a lot
George

Hi George,

Thank you for contacting Aspose support team.

You may please use DateComparisonType to achieve the required output as follows:

ExchangeQueryBuilder qb = new ExchangeQueryBuilder();
qb.InternalDate.BeforeOrEqual(pToDate, DateComparisonType.ByDateTime);
qb.InternalDate.Since(pFromDate, DateComparisonType.ByDateTime);

Hi Kashif,

Thanks a lot for help,
Works perfect.
George

You are welcome.