Filter request to outlook api v2.0 with 'gt' parameter works not as expected RRS feed

  • Question

  • I am using outlook 365 API to get email from mailbox. My request looks like:$filter=ReceivedDateTime gt 2016-05-06T11:41:01Z&top=50
    In documentation for outlook 365 rest API search parameter 'gt' specified as "greater than" but in practice it works as "greater or equals" because in result it returns email with ReceivedDateTime = 2016-05-06T11:41:01Z too; should be '> 2016-05-06T11:41:01Z' but works as '>= 2016-05-06T11:41:01Z'. Maybe there is some issue with API, or my request is not correct... can anybody help me?
    Monday, May 9, 2016 10:49 AM

All replies

  • Hi Vasylius,

    This forum is used to discuss about Outlook developing issue like outlook automation, your issue is more related with O365 rest api, I will move this thread to the more related forum.


    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 10, 2016 2:38 AM
  • That is due to a loss in precision in the REST APIs. Most date fields (including receivedDateTime) are actually stored with more precision than second. Your request is being translated to a query where the receivedDateTime > 11:41:01.0000. Messages that received at 11:41:01.01 are technically greater than that, so you will get that message .

    As a workaround , you could try to use "ge" for the next unit, make your query as  receivedDateTime >= 11:41:02.0000 , the time between 11:41:01.0000 and  11:41:02.0000 will be avoid :$filter=ReceivedDateTime ge 2016-05-06T11:41:02Z&top=50

    Tuesday, May 10, 2016 8:25 AM
  • Thanks for quick response. I implemented it by such way.
    Wednesday, May 11, 2016 8:47 AM
  • Thanks
    Wednesday, May 11, 2016 8:47 AM