Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to use receivedDateTime in Graph API Request?

I am trying to use the receivedDateTime filter clause when calling the Graph API, but I’m running into issues when I use the exact datetime. For example, when I try running this API call:

GET https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge '2022-05-23T12:29:00'&$orderby=receivedDateTime%20ASC&$top=100&$skip=0

I get a 400 bad request (the specific error mentions "bad filter clause"). But it works when I run this one:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

GET https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge 2022-05-23'&$orderby=receivedDateTime%20ASC&$top=100&$skip=0

What can I do if I want to use the exact datetime in the filter clause, or is this even possible?

>Solution :

You need to append the Z in the ISO 8601 time format, where Z represents the zone designator for the zero UTC offset. (e.g. 2022-05-23T11:59:59Z)

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge 2022-05-23T11:59:59Z
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading