Add-on menu doesn't get created when published through G-Suite Marketplace SDK, but does through Chrome Web Store

独自空忆成欢 提交于 2020-07-31 05:01:08

问题


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.

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

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

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

回答1:


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.



来源:https://stackoverflow.com/questions/56922595/add-on-menu-doesnt-get-created-when-published-through-g-suite-marketplace-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!