通过G-Suite Marketplace SDK发布时不会创建附加菜单,但通过Chrome Web Store会创建 [英] Add-on menu doesn't get created when published through G-Suite Marketplace SDK, but does through Chrome Web Store

查看:96
本文介绍了通过G-Suite Marketplace SDK发布时不会创建附加菜单,但通过Chrome Web Store会创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论是使用createAddonMenu()还是createMenu(),当通过GSM安装附件或通过G-Suite Marketplace SDK与与Google集成一起打开时,我都无法创建菜单。通过脚本编辑器进行的作为加载项进行测试有效,通过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. "Test as add-on" via Script Editor works, installation via Chrome Web Store works, and I have no idea what might be wrong. I'm not sure if the script runs in the first place.

我尝试了StackOverflow的现有解决方案,例如以不同的顺序调用函数,但是似乎没有任何效果。

I've tried existing solutions from StackOverflow such as calling functions in different order, but nothing seems to work.

有人知道什么可能阻止加载项/脚本与GSM一起使用吗?

Does someone know what might prevent add-on/script from working with GSM?

这里是onOpen和我使用过的onInstall函数。

Here's onOpen and onInstall functions I used.

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);
}


推荐答案

发布为未列出的加载项通过GSM安装时,未在带有旧版G-Suite服务的编辑器中显示。这似乎已在该服务的当前版本中修复。

Add-ons published as unlisted didn't show up in editor with older version of G-Suite services when installed through GSM. This appears to be fixed in current version of the service.

这篇关于通过G-Suite Marketplace SDK发布时不会创建附加菜单,但通过Chrome Web Store会创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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