Reputation: 21
I'm trying to get the emails I received within the last 24 hours using the Microsoft graph API. Currently I'm using this request url: https://graph.microsoft.com/beta/me/messages
I currently get the last 10 emails. How do I have to modify the request url in order to get the Emails received within the last 24hours?
Upvotes: 2
Views: 3687
Reputation: 22032
Two ways you could do it first is with a Filter for messages with a received date greater than your search range eg
https://graph.microsoft.com/beta/me/messages?Top=500&$filter=(receivedDateTime gt 2020-08-05T00:00:00Z)&Select=Subject,receivedDateTime
Or do a search using the reserved keywords (today, yesterday etc)
https://graph.microsoft.com/beta/me/messages?search="received:yesterday"&Select=Subject,receivedDateTime&Top=250
Upvotes: 3