google-apps-script - getThreads 的超大标签

标签 google-apps-script

我在一个标签中有 900 多个线程。我想把它们全部取出来在脚本中计算出一些指标。 getThreads()似乎最多 500 个线程,这与文档所说的一致:

This call will fail when the size of all threads is too large for the system to handle. Where the thread size is unknown, and potentially very large, please use the 'paged' call, and specify ranges of the threads to retrieve in each call.



所以现在的问题是当我这样做
GmailApp.getUserLabelByName("Huge Label").getThreads(501, 1000).length;

我收到消息:“最大参数不能超过 500。”关于如何处理具有非常大线程数的标签的任何建议?

最佳答案

getThreads() 方法的签名是

getThreads(start, max)

所以你必须使用
GmailApp.getUserLabelByName("Huge Label").getThreads(501, 500).length;

这将使您的线程从 501 返回到 1000。

关于google-apps-script - getThreads 的超大标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15573319/

相关文章:

google-apps-script - 确定 Google Apps Script WebApp 是否在/dev 模式下运行

google-apps-script - 如何删除手动换行符

arrays - 如何为已打乱的数组添加依赖项?

google-apps-script -\n在Google Apps脚本Browser.msgBox中不起作用

google-apps-script - 如何使用 Google Apps 脚本将 .heic 从 Google 表单转换为 .jpeg,然后上传到 Google 云端硬盘

javascript - 仅生成一张电子表格的 PDF

google-apps-script - Apps 脚本 .getActivePage() 仅返回 "home"页面

google-apps-script - 每次部署的应用程序脚本网络更改版本

mysql - 通过 Google Script 中的 jdbc 连接发送多个 mysql 指令

javascript - 创建新站点列表页面后,如何为其添加值?