Google Apps Script - AuthMode - no menus are visib

2019-06-05 04:02发布

My app has been approved, and I am at the final approval that requires addon installation testing.

Here is what Google Docs ux team says

"There appears to be a problem with the authMode setup - likely on the onOpen function. This causes the menu items to only appear on the first doc the add-on is installed in. Appears empty on all other docs (screenshot attached). For more info: https://developers.google.com/apps-script/add-ons/lifecycle#opening"

Here is an unresolved similar issue Google Add-on adding menu items in limited mode app scripts Now, I am not doing anything special in onOpen and onInstall, just textbook stuff. Any tips? (redacted the menu titles...)

function onOpen(e) {

  DocumentApp.getUi().createAddonMenu()
    .addItem('menu1...', 'showSidebar')
    .addItem('Buyxxxxx', 'showSales')
    .addItem('Getting Started', 'showIntro')
    .addToUi();
}

/**
 * Runs when the add-on is installed.
 *
 * @param {object} e The event parameter for a simple onInstall trigger. To
 *     determine which authorization mode (ScriptApp.AuthMode) the trigger is
 *     running in, inspect e.authMode. (In practice, onInstall triggers always
 *     run in AuthMode.FULL, but onOpen triggers may be AuthMode.LIMITED or
 *     AuthMode.NONE.)
 */
function onInstall(e) {
  onOpen(e);
}

1条回答
倾城 Initia
2楼-- · 2019-06-05 04:32

The warning here helped https://developers.google.com/apps-script/guides/menus

Need to look at console for errors, and I found one:

Google Apps Script: You do not have permission to call getPublicCache

查看更多
登录 后发表回答