How to get unread mails from primary inbox in Gmail?

天大地大妈咪最大 提交于 2019-12-02 03:06:58

问题


I'm using the Javascript client API with my app and I'm trying to get unread mails from the primary inbox.

If I use the INBOX and UNREAD names when requesting the labels I get all unread mails from all labels.

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?


回答1:


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.

I have 4 "UNREAD" mails(or Threads) in my inbox, and response is:

200 OK

{
 "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
}



回答2:


Try also this "in:inbox is:unread category:primary"




回答3:


You could try "in:unread category:primary "



来源:https://stackoverflow.com/questions/27953600/how-to-get-unread-mails-from-primary-inbox-in-gmail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!