Jacobs
Jacobs

Reputation: 35

refreshSlides Exception: Action not allowed

I Have a working Google slides version 2020, I copied this to version 2021. But now I get the error

Exception: Action not allowed
refreshSlides   @ Code.gs:9

The script is :

function refreshSlides(){
  var currentPresentation, i, linkedSlide, numSlides
  
  // loop through all slides and refresh them
    currentPresentation = SlidesApp.getActivePresentation();
    numSlides = currentPresentation.getSlides().length;
    for (i = 0; i < numSlides; i++) {
      linkedSlide = currentPresentation.getSlides()[i]
      linkedSlide.refreshSlide();
    Utilities.sleep(5000);

    }
}

I tried to add authorization by adding (see below) to appsscript.json

  "oauthScopes": [
    "https://www.googleapis.com/auth/presentations.currentonly",
    "https://www.googleapis.com/auth/presentations"
  ],

But that didn't help. What am I missing here??

Upvotes: 0

Views: 316

Answers (2)

Marios
Marios

Reputation: 27350

As it is stated in the official documentation, refreshSlide() drops an error:

If read-access to the source presentation is no longer available.

Make sure you have read-access to the active presentation and to every slide.

Upvotes: 1

Jacobs
Jacobs

Reputation: 35

Solved, There was one slide that was a 'linked slide' to the linked slide was no authorization.

Upvotes: 0

Related Questions