EWS SearchFilter.IsGreaterThan RRS feed

  • Question

  • hi Team,

    varibale topListItemDate="9/21/2017 PM 12:30:37"

    After using below command, it fetches the mails including the above date mail as if it is working like greaterthanorequalto.  I used datetime.Parse also. but it didnt worked. Please help to resolve this issue

    SearchFilter.IsGreaterThan searchFilter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived, topListItemDate);

    Thursday, September 21, 2017 10:50 AM

All replies

  • Exchange stores the datetimes with a precision down to the Millisecond, EWS  by default gives you a precision on datetimes to the second you can change this using . So with your Searchfilters you should specify the time with a precision of milliseconds with Date time. eg

    SearchFilter searchFilter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived, DateTime.ParseExact("2017/09/21 12:30:37.999", "yyyy/MM/dd HH:mm:ss.fff", null));

    Thursday, September 21, 2017 11:28 PM