简体   繁体   中英

Google apps script Gmail oldest thread date

I write script for find first written thread in Gmail. How using google apps script get oldest thread date in inbox?

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

UPDATED: You can use the below snippet.

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

Please refer the link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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