简体   繁体   English

特定收件箱文件夹的getInboxThreads()。 Google Apps脚本gmail

[英]getInboxThreads() for specific inbox folder. Google Apps Script gmail

I am trying to retrieve email threads from only a specific folder which I named 'Approval_needed'. 我正在尝试仅从名为“ Approval_needed”的特定文件夹中检索电子邮件线程。 I have found a way to get all of my inbox threads like so from the Google Apps Script Reference page : 我从Google Apps脚本参考页面找到了一种获取所有收件箱线程的方法,如下所示:

var threads = GmailApp.getInboxThreads();
 for (var i = 0; i < threads.length; i++) {
   Logger.log(threads[i].getFirstMessageSubject());
 }

Is it possible to do something like getInboxThreads for folder 'Approval_needed' ? 是否可以getInboxThreads for folder 'Approval_needed'执行类似getInboxThreads for folder 'Approval_needed'
I have searched around and have not found an answer for this. 我到处搜寻,却没有找到答案。 I have found other methods such as getPriorityInboxThreads() and getStarredInboxThreads() , but nothing like getInboxThreads(string) . 我发现了其他方法,例如getPriorityInboxThreads()getStarredInboxThreads() ,但是没有什么像getInboxThreads(string)

What you are calling "folder" is actually a "label" in gmail, you can use the getThreads() method on the Label class. 您所谓的“文件夹”实际上是gmail中的“标签”,您可以在Label类上使用getThreads()方法。

Example from the documentation : 文档中的示例:

// Log the subject lines of the threads labeled with MyLabel
 var label = GmailApp.getUserLabelByName("MyLabel");
 var threads = label.getThreads();
 for (var i = 0; i < threads.length; i++) {
   Logger.log(threads[i].getFirstMessageSubject());
 }

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

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