get current thread id in gmail using google app script

荒凉一梦 提交于 2021-01-29 10:42:05

问题


I am building a Gmail Add-On. I want to get the thread Id of current open email thread using Google Apps Script. I tried to figure out in Google Developers documentation for GmailApp. But nothing found relevant.


回答1:


You can retrieve messageId of the current message from e.messageMetadata.messageId of buildAddOn(e). Using this, you can retrieve threadId as follows.

var threadId = GmailApp.getMessageById(messageId).getThread().getId();

References :

  • getMessageById()
  • getThread()

If this was not what you want, I'm sorry.



来源:https://stackoverflow.com/questions/50267172/get-current-thread-id-in-gmail-using-google-app-script

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