0
votes

I query emails from my Office 365 mailbox, which are received before a particular date using Microsoft Graph API.

I use following quert : https://graph.microsoft.com/v1.0/users/*email*/mailfolders/Archive/messages?$filter=ReceivedDateTime lt 2020-04-01

I have manually checked the 'Archive' folder and there are many emails which are received before 2020-04-01. Hence the query should provide output.

My application will automatically run this query every 5 min.

While testing, I found that once the app started it run 12 times (1 hour) and gave correct output, however 13th call onwards, all subsequent calls are giving NULL JSON output.

I get following JSON response:

<?xml version = "1.0" encoding = "UTF-8"?>
<ns0:RESTOutput xmlns:ns0 = "xxx">
<StatusCode>200</StatusCode>
<msg></msg>
</ns0:RESTOutput>

Please suggest.

1
Have you cross checked the mailbox whether the archive folder contains the items with the receiveddatetime field against your above query filter (receiveddatetime) when you see NULL? - Dev
Outside of your code, can you repro the issue in Graph Explorer/POSTMAN as well? - Dev
I tried repro the issue, but it works for me. I dont see issue with MS Graph API call. - Dev
Gotcha. Let me move this one to answer then ... So it can be useful to others as well; consider upvoting it. - Dev

1 Answers

0
votes

I tested the Graph API call work in MS Graph Explorer and it works without any issue.

API call:

https://graph.microsoft.com/v1.0/users/*email*/mailfolders/Archive/messages?$filter=ReceivedDateTime lt 2020-04-01