有没有一种方法可以一次在Google应用程序脚本的Gmail线程中添加多个标签? [英] Is there a way to add multiple labels at once to a Gmail thread in a google app script?

查看:73
本文介绍了有没有一种方法可以一次在Google应用程序脚本的Gmail线程中添加多个标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以编程方式在Google-app脚本中向Gmail线程添加一些标签.

I am trying to add some labels to Gmail threads in a google-app script programmatically.

使用 thread.addLabel 现在起作用.因为我要向多个线程添加多个标签,所以这种方法首先会导致配额使用效率低下,效率低下.我必须为每个线程的每个标签调用thread.allLabel.

Using thread.addLabel function right now. Because I am adding multiple labels to many threads, this approach is first slow and second inefficient in quota usage. I have to call thread.allLabel for every label for every thread.

是否可以将多个标签一起添加到Gmail线程/邮件中?Gmail API具有 thread.modify 函数,可用于添加多个标签.Google Apps脚本中是否有类似内容?

Is there a way to add multiple labels to Gmail threads / messages together? The Gmail API has a thread.modify function that can be used to add multiple labels. Is there something similar in google apps script ?

推荐答案

您要使用Google Apps脚本向线程添加多个标签.如果我的理解正确,那么如何使用高级Google服务的Gmail API?在GmailApp中,找不到用于向线程添加多个标签的方法.因此,我提出了这一建议.我认为您可以使用 gmail.users.messages.modify 实现它.示例脚本如下.为了使用此脚本,请在高级Google服务和API控制台中启用Gmail API.

You want to add several labels to a thread using Google Apps Script. If my understanding is correct, how about using Gmail API of Advanced Google Services? In GmailApp, I couldn't find methods for adding several labels to a thread. So I propose this. I think that you can achieve it using gmail.users.messages.modify. The sample script is as follows. In order to use this script, please enable Gmail API at Advanced Google Services and API console.

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆