简体   繁体   English

Gmail API查询以检索给定时间后发送的未读邮件

[英]Gmail API query to retrieve unread messages sent after given time

I am using gmail api to programatically retrieve email messages (using javascript) which are: 1. unread 2. sent after a given time 我正在使用gmail api以编程方式检索电子邮件消息(使用javascript):1.未读2.在给定时间后发送

I know the query for retrieving unread messages is : 'is:unread' and the query for retrieving messages sent after a particular date is 'in:sent after : yyyy/mm/dd' 我知道检索未读邮件的查询是:'is:unread',检索特定日期后发送的邮件的查询是'in:send after:yyyy / mm / dd'

But How do we combine the above two queries into a single query? 但是,我们如何将以上两个查询合并为一个查询?

Also, if there is any documentation for the queries for searching messages supported by gmail api, please share the same - I don't seem to find it. 另外,如果有用于查询gmail api支持的邮件的查询的文档,请共享相同的内容-我似乎找不到它。

query = is:unread OR (is:sent AND after:<TIME_IN_SECONDS_SINCE_EPOCH>)

Let's say you wanted unread or sent messages after Fri, 04 Jan 2013 07:00:00 GMT, you would write: 假设您想在格林尼治标准时间2013年1月4日星期五7:00之后阅读或发送邮件,请写:

query = is:unread OR (is:sent AND after:1357282800)

GET https://www.googleapis.com/gmail/v1/users/me/messages?q=is%3Aunread+OR+(is%3Asent+AND+after%3A1357282800)&key={YOUR_API_KEY}

The query is identical to the search bar in the Gmail Client, so anything you can find in the Advanced search documentation works, even though some things (like the seconds since epoch-query above) are undocumented. 该查询与Gmail客户端中的搜索栏相同,因此即使未记录某些内容(例如,从上述纪元查询起的秒数),您也可以在“ 高级”搜索文档中找到任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM