【发布时间】:2019-06-05 05:23:04
【问题描述】:
我为在 Gmail 中查找第一个书面线程编写脚本。如何使用谷歌应用程序脚本获取收件箱中最旧的线程日期?
var thread = GmailApp.getInboxThreads(0,1)[0];
var message = thread.getMessages()[0]; // Get first message
Logger.log(message.getDate()); // Log date and time of the message
【问题讨论】:
-
欢迎来到 stack 我们不是编码服务。请编辑您的问题并包含您的代码并描述您在解决方案中遇到的任何问题
-
此代码
var thread = GmailApp.getInboxThreads(0,1)[0]; var message = thread.getMessages()[0]; // Get first message Logger.log(message.getDate()); // Log date and time of the message给出了第一个消息日期,但我需要收件箱中线程或消息的最后日期 -
所以不要只读取消息数组中的第一条消息。查看线程中的所有消息。
-
我明白这一点,我通过使用有问题的脚本找到了第一个线程日期,但是如何获得最后一个线程日期?
标签: javascript google-apps-script google-api gmail gmail-api