[英]Add-on menu doesn't get created when published through G-Suite Marketplace SDK, but does through Chrome Web Store
Whether by using createAddonMenu() or createMenu(), I can't create menu when add-on is installed through GSM, or when opened with "Integrate With Google" via G-Suite Marketplace SDK.无论是使用 createAddonMenu() 还是 createMenu(),当通过 GSM 安装附加组件时,或者通过 G-Suite Marketplace SDK 使用“与 Google 集成”打开时,我都无法创建菜单。 "Test as add-on" via Script Editor works, installation via Chrome Web Store works, and I have no idea what might be wrong.
通过脚本编辑器“作为插件进行测试”工作,通过 Chrome 网上应用店安装工作,我不知道可能有什么问题。 I'm not sure if the script runs in the first place.
我不确定脚本是否首先运行。
I've tried existing solutions from StackOverflow such as calling functions in different order, but nothing seems to work.我已经尝试过 StackOverflow 中的现有解决方案,例如以不同的顺序调用函数,但似乎没有任何效果。
Does someone know what might prevent add-on/script from working with GSM?有人知道什么可能会阻止附加组件/脚本与 GSM 一起使用吗?
Here's onOpen and onInstall functions I used.这是我使用的 onOpen 和 onInstall 函数。
function onOpen(e) {
if(LOGENAB){console.log("onOpen...");}
if(LOGENAB){console.log(e.authMode);}
if(e && e.authMode == ScriptApp.AuthMode.NONE){
// Authorization needed
if(LOGENAB){console.log("# Authorization required!");}
var ui = FormApp.getUi();
var menu = ui.createMenu('title');
menu.addItem('Authorize', 'authorizeAddon');
menu.addToUi();
} else {
// Authorization not needed
if(LOGENAB){console.log("# Authorization OK!");}
var ui = FormApp.getUi();
var menu = ui.createMenu('title');
menu.addItem('Control Panel', 'showControlPanel');
menu.addItem('About', 'showAbout');
menu.addItem('Reset running status','toggleStatus');
menu.addToUi();
}
}
function onInstall(e) {
if(LOGENAB){console.log("onInstall...");}
onOpen(e);
}
Add-ons published as unlisted didn't show up in editor with older version of G-Suite services when installed through GSM.通过 GSM 安装时,以不公开形式发布的附加组件不会显示在带有旧版 G-Suite 服务的编辑器中。 This appears to be fixed in current version of the service.
这似乎已在当前版本的服务中修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.