Reputation: 41
Is there a way using gmail rest API to get the oldest UNREAD mail or list eg. 10 oldest UNREAD mails?
Right now i am getting all unread mails from a specific email folder by looping using nextPage until i reach the last page. There i get the last message id, which seems to refer to the oldest email. I works and the mail id's seems to be listed in order newest first and oldest last in the list.
This is the query i am using:
https://gmail.googleapis.com/gmail/v1/users/[email protected]/messages?labelIds="folderI"&includeSpamTrash=false&pageToken="nextPage"&q=is:unread
Is there a more effective way to get the oldest UNREAD mail or to get a list of say the 10 oldest UNREAD mails?
Upvotes: 2
Views: 233
Reputation: 2014
There is no direct way to do it, but you can use the the q
parameter search properties Search operators you can use with Gmail to get the messages from a certain period or with a max date to get less emails to go through.
Upvotes: 0