管理触发器的Google Apps脚本执行失败通知 [英] Manage Google Apps Script execution failure notifications for triggers

查看:92
本文介绍了管理触发器的Google Apps脚本执行失败通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过脚本代码管理Google Apps脚本中触发器的失败通知?我知道它可以从Google Apps脚本控制台中实现,但我想通过我的代码中的函数删除通知,在该代码中添加基于时间的触发器。或者有没有其他办法可以删除这种通知?解析方案

答案不是,不幸的是。管理这些通知电子邮件的唯一方法是通过用户界面。您可以在这里查看文档: https://developers.google.com/apps-script / reference / script /



如果您想更密切地控制失败通知,一种可能的解决方法是关闭Google的通知,然后让您的拥有。您可以使用错误捕获语句或其他方法来确定脚本何时失败,然后使用Gmail服务的 GmailApp 类根据任何内容发送通知你喜欢的规则。



但是这听起来像是你真正的问题是你不想通过编程添加触发器来通过UI手动关闭所有这些通知。以下是一个拙劣的解决方案:当您添加此触发器时,还需添加一项功能,以删除为此脚本收到的故障通知电子邮件。您可以使用 Gmail服务执行此操作。


Is it possible to manage failure notification for triggers in Google Apps Script via script code? I know that it is possible from Google Apps Script console, but I want to remove notification via function in my code, where I add time based triggers. Or is there any other way to remove this kind of notification?

解决方案

The answer is no, unfortunately. The only way to manage these notification emails is via the UI. You can check the documentation here: https://developers.google.com/apps-script/reference/script/

If you want to control the failure notifications more closely, one possible workaround would be to turn off Google's notifications, and then make your own. You could use either error catching statements or some other method to identify when your script has failed, and then use the GmailApp class of the Gmail service to send notifications according to whatever rules you like.

But it sounds like your real problem is that you don't want to have to manually turn off all these notifications via the UI when programmatically adding triggers. Here's a hacky solution: when you add this trigger, also add a feature that deletes the failure notification emails received for this script. You can use the Gmail service to do that.

这篇关于管理触发器的Google Apps脚本执行失败通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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