从18年6月21日上午1时10分开始,在其中一个具有后台脚本的google电子表格中,欧洲中部时间反复要求我分别进行授权,并发送包含以下内容的“ Google Apps脚本失败摘要”电子邮件。
开始功能错误消息触发结束 18/6/21上午3:54需要ScanGmail授权才能执行该操作。基于时间6/21/18 3:54
我现在已经多次使用'function auth(){}'来再次授予授权(好像每次注销或计算机进入睡眠模式时都必须这样做)。
我还实现了授权脚本,但是没有发送任何授予授权的电子邮件,只有应用脚本错误通知。
var addonTitle = 'PRE_Inv_Conf';
var props = PropertiesService.getDocumentProperties();
var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL);
// Check if the actions of the trigger requires authorization that has not
// been granted yet; if so, warn the user via email. This check is required
// when using triggers with add-ons to maintain functional triggers.
if (authInfo.getAuthorizationStatus() ==
ScriptApp.AuthorizationStatus.REQUIRED) {
// Re-authorization is required. In this case, the user needs to be alerted
// that they need to re-authorize; the normal trigger action is not
// conducted, since it requires authorization first. Send at most one
// "Authorization Required" email per day to avoid spamming users.
var lastAuthEmailDate = props.getProperty('lastAuthEmailDate');
var today = new Date().toDateString();
if (lastAuthEmailDate != today) {
if (MailApp.getRemainingDailyQuota() > 0) {
var html = HtmlService.createTemplateFromFile('AuthorizationEmail');
html.url = authInfo.getAuthorizationUrl();
html.addonTitle = addonTitle;
var message = html.evaluate();
MailApp.sendEmail(Session.getEffectiveUser().getEmail(),
'Authorization Required',
message.getContent(), {
name: addonTitle,
htmlBody: message.getContent()
}
);
}
props.setProperty('lastAuthEmailDate', today);
}
} else {
Google CET 6/21/18 1:59 AM发生了什么变化,还是出了什么问题,有办法避免这种行为吗?
答案 0 :(得分:0)
这似乎是Google的错误,因为受影响的电子表格或相关的Google帐户对我而言没有任何改变。不知道它是否出现,因为我正在运行多个Google帐户,但这是我的解决方案。
到目前为止,似乎该解决方法已修复了Google错误。电子表格或后台脚本现在正在按预期方式运行,就像他们在CET 21/21/18 1:59 AM之前一样