如何在我的 Google 脚本代码中将我的脚本更改为 AuthMode.LIMITED?

How can I change my script to AuthMode.LIMITED in my Google Scripts code?

我试图发布已创建的附加组件的新版本,但是当我尝试发布它时,我可以看到菜单、子菜单并且可以执行附加组件 Picture 1. The problem is that the other users -who before were able to execute the Add-On- now they don't see the sub-menus and obviously they can't execute the Add-On Picture 2.

我Googled有点,我正在研究这个,所以我发现有一个方法叫做AuthMode.NONE和AuthMode.LIMITED,我知道它们之间的区别但是我不知道 Google 脚本如何对附加组件进行分类以及如何 force 将 AuthMode 更改为 LIMITED,或者您可以给我另一个可以提供帮助的解决方案。

顺便说一句:我已经检查过是否为我的文档激活了加载项,是的,我的意思是我有以下选项:加载项 --> 管理加载项 -- > [我的插件] --> 管理 --> 在本文档中使用 选中。

PD:我试过卸载和安装附加组件,发布和重新发布新版本,我尝试了很多但没有解决方案。

提前致谢!

Authorization modes 阅读这篇文章可能会有所帮助:

If an add-on is installed for a user but not enabled in the current document, onOpen(e) runs in AuthMode.NONE; if the add-on is enabled in the current document, onOpen(e) runs in AuthMode.LIMITED. If the add-on is both installed and enabled, the enabled state takes precedence, since LIMITED allows access to more Apps Script services.

Note that only published add-ons can be in AuthMode.NONE; scripts that are bound to a document, including add-ons in development, always run onOpen(e) in AuthMode.LIMITED. You can, however, test a script as an add-on to verify that an add-on under development will behave as intended in either AuthMode.

检查此 SO thread 以获取更多参考。