当调用"Users.messages:list"时,Gmail API以什么顺序返回邮件? [英] In what order does the Gmail API return messages when calling "Users.messages: list"

查看:61
本文介绍了当调用"Users.messages:list"时,Gmail API以什么顺序返回邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 Gmail API参考,用户.messages:列出"[列出]用户邮箱中的消息".在我看来,消息是按数据降序返回的.这是正确的假设吗?

According to the Gmail API reference, Users.messages: list "[lists] the messages in the user's mailbox". In my observation, the messages are returned in descending order by data. Is this a correct assumption?

基本上,我希望能够在几天后处理用户的收件箱,而无需重新处理已经处理过的消息.如果我偶然发现以前收到的电子邮件,我会停止操作.使用历史记录并不可靠,因为据记录,历史记录可能会在几个小时内到期,因此需要进行全新的同步.

Basically I want to be able to process a user's inbox after a couple of days without reprocessing messages I have already processed. I would do that by stopping once I stumble upon an email I have seen before. Using the history doesn't work reliable, since it is documented that history might expire within a few hours, requiring a full new sync.

推荐答案

是的,您是正确的.消息以降序返回,最新消息优先.

Yes, you are correct. Messages are returned in descending order, with the newest one first.

几天后,您可以保存最新消息的internalDate,并在查询中列出具有该值的新消息.

You could save the internalDate of the newest message and list new messages with that value in the query a few days later.

示例

internalDate = 1490213949000 // Wed Mar 22 2017 21:19:09 GMT+0100 (CET)

q=after:1490213949 // 'after' takes seconds since the epoch. internalDate/1000

这篇关于当调用"Users.messages:list"时,Gmail API以什么顺序返回邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆