2015-03-19 34 views
1

我的應用程序已獲批准,並且我處於最終批准狀態,需要進行插件安裝測試。Google Apps腳本 - AuthMode - 安裝後沒有任何菜單

下面是谷歌文檔UX團隊說

「似乎有與authMode設置有問題 - 可能在 的OnOpen功能這將導致菜單項,僅在 第一DOC出現加載項是安裝在空出現在所有其他文檔 (截圖附後)欲瞭解更多信息:。 https://developers.google.com/apps-script/add-ons/lifecycle#opening

這是一個尚未解決的類似問題Google Add-on adding menu items in limited mode app scripts 現在,我沒有做任何特別的onOpen和onInstall,只是教科書的東西。有小費嗎? (節錄菜單標題...)

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

警告這裏幫助https://developers.google.com/apps-script/guides/menus

需要看控制檯的錯誤,我發現一個:

谷歌Apps腳本:你做沒有權限調用getPublicCache

+1

難道你沒有任何需要權限的全局代碼嗎?當我遇到這個問題時,我打電話給全球評論中的SpreadsheetApp。看起來甚至評論可能會干擾授權。 – filipeglfw 2015-03-23 22:28:10

+0

原來,我有一個緩存包裝,它是通過對象字面量來定義的!所以,我傾倒了對象的文字符號,並使用構造符號http://stackoverflow.com/questions/12356994/literal-notation-vs-constructor-to-create-objects-in-javascript – giorgio79 2015-03-24 06:00:01