如何从 Gmail 的主收件箱中获取未读邮件? [英] How to get unread mails from primary inbox in Gmail?
问题描述
我正在将 Javascript 客户端 API 与我的应用程序一起使用,并且我正在尝试从主收件箱中获取未读邮件.
I'm using the Javascript client API with my app and I'm trying to get unread mails from the primary inbox.
如果我在请求标签时使用 INBOX 和 UNREAD 名称,我会收到来自所有标签的所有未读邮件.
If I use the INBOX and UNREAD names when requesting the labels I get all unread mails from all labels.
没有其他标签类型名称有效,我已经在 API 资源管理器中进行了试验,但似乎无法弄清楚如何管理它.
No other label type name works, I've experimented in APIs explorer and i can't seem to figure out how to manage this.
我是否遗漏了什么或不可能?
Am I missing something or is it not possible?
推荐答案
你可以试试这个 "in:inbox is:unread -category:(promotions OR social)" 作为 q 参数的值在 messages.list 中.我在 API 资源管理器中尝试了这个,它给出了正确的结果.
You can try this "in:inbox is:unread -category:(promotions OR social)" as a value for q parameter in messages.list. I tried this in API explorer, and it gave correct results.
我的收件箱中有 4 封未读"邮件(或主题),回复是:
I have 4 "UNREAD" mails(or Threads) in my inbox, and response is:
200 正常
{
"messages": [
{
"id": "14aea080215aa680", --- Thread 1
"threadId": "14aea080215aa680"
},
{
"id": "14ae8e25e92657e3", --- Thread 2
"threadId": "14ae8e25e92657e3"
},
{
"id": "14ae5e7a8bb1bc2f",-- Thread 3
"threadId": "14ae433c5ae8de64"
},
{
"id": "14ae439fd8cd3726",-- Same thread 3 with different message id
"threadId": "14ae433c5ae8de64"
},
{
"id": "14ae433c5ae8de64",-- Same thread 3 with different message id
"threadId": "14ae433c5ae8de64"
},
{
"id": "14ae33d8431a06f3",-- Thread 4
"threadId": "14ae33d8431a06f3"
}
],
"resultSizeEstimate": 6
}
这篇关于如何从 Gmail 的主收件箱中获取未读邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!