问题
Seems to happen when you are logged in with 2 different accounts to Google and test the app - 1 account in Chrome browser and another in Google Slides app or Apps Script panel.
Other than that, all works fine.
I have a function imageToSlide
called from html template like this:
google.script.run
.withSuccessHandler(sidebar.onSuccess)
.withFailureHandler(sidebar.onAddDocumentError)
.imageToSlide(url, link, width, height);
Inside it I do var presentation = SlidesApp.getActivePresentation();
After switching to V8 runtime I get an error:
Exception: Action not allowed
It is not a container-bound script. It works without issues in DEPRECATED_ES5
mode.
Google docs say:
If the presentation is already open, the same presentation instance is returned.
I tried using SlidesApp.openById(id)
getting presentation id from the event passed to onOpen
-> e.source.getId()
but still did not work.
来源:https://stackoverflow.com/questions/60453863/slides-app-getactivepresentation-error-after-v8-migration