【发布时间】:2019-09-11 16:56:45
【问题描述】:
我正在尝试在已发送项目的线程中获取所有消息。在下面的代码中,我可以将变量“mails”中的所有发送线程作为[GmailThread GmailThread ..]。 mails[0].getId() 也给出了 mails[0] 的 threadId。
var mails = GmailApp.search('in:sent');
Logger.log(mails[0].getMessages());
但 mails[0].getMessages() 返回运行时错误为
Access denied: : Missing access token for authorization. Request: MailboxService.GetThread.
这是我包含的范围。
"oauthScopes": [
"https://www.googleapis.com/auth/gmail.addons.execute",
"https://www.googleapis.com/auth/script.external_request",
"https://www.googleapis.com/auth/gmail.addons.current.message.action",
"https://www.googleapis.com/auth/gmail.addons.current.action.compose",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.modify",
"https://mail.google.com/"
]
现在我想要的是获取 mails[0] 中的所有消息。
【问题讨论】:
-
可能是用户拒绝了权限?
标签: google-apps-script gmail gmail-addons