I recently created and published a Google-Docs add-on, but have run into an issue when trying to download and use it with another account.
When I first install it in a document, the menu items show up and everything is working fine.
However, when I open up a new document, and try to use the menu, all the items have disappeared and I'm left with "Help." (see screenshot)
The only way to fix this issue is to click Add-ons --> Manage Add-ons --> click use in document, and then reload the page. (screenshots)
However, I would like to set the add-on to be used in every document by default, so that users won't have to go through this process and reload every time they create a new document. (I am also open to any other solution that allows the menu items to be shown)
This is the code I use to create the menu upon installing or opening.
function onInstall(e) {
onOpen(e);
}
function onOpen(e) {
DocumentApp.getUi().createAddonMenu()
.addItem('Function 1', 'functionOne')
.addSeparator()
.addItem('Function 2','functionTwo')
.addItem('Function 3', 'functionThree')
.addToUi();
}
The logs show the following error:
You do not have permission to call getUserProperties.
Some relevant info: whenever the script runs, it checks whether the user has saved any settings (which would be in user properties), and if there are no settings, it sets them to default. Is it possible that I cannot access user properties from new documents?
Let me know if I should provide any other information, such as the name of the add-on
You should review Editor add-on authorization. Briefly, add-ons run on limited authorization mode when they are not enabled for the active document (form, spreadsheet, presentation). To check the authorization mode use authMode
property of the open event object before calling any method that requires full authorization mode to run.
Related