【问题标题】:refreshSlides Exception: Action not allowedrefreshSlides 异常:不允许操作
【发布时间】:2021-02-10 10:12:01
【问题描述】:

我有一个可用的 Google 幻灯片 2020 版,我将它复制到了 2021 版。 但现在我得到了错误

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

脚本是:

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);

    }
}

我尝试通过向 appsscript.json 添加(见下文)来添加授权

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

但这并没有帮助。 我在这里错过了什么??

【问题讨论】:

    标签: google-apps-script google-slides-api


    【解决方案1】:

    正如official documentation 中所述,refreshSlide() 丢弃错误:

    如果对源演示文稿的读取权限不再可用。

    确保您对当前演示文稿和每张幻灯片都有读取权限。

    【讨论】:

    • 我正在使用此演示文稿的脚本编辑器,因此我假设我具有读取权限....
    • 您对每张幻灯片都有阅读权限吗? @雅各布
    • 有简单的方法来检查吗?我是演示文稿的编辑器
    • @Jacobs 不幸的是,我无法复制这个问题.. 请演示文稿的所有者让您编辑或删除不必要的保护。
    • 谢谢马里奥斯,我已经是编辑了。但我会检查是否有任何保护措施。
    【解决方案2】:

    已解决,有一张幻灯片是“链接幻灯片” 对链接的幻灯片没有授权。

    【讨论】:

      猜你喜欢
      • 2017-11-05
      • 1970-01-01
      • 1970-01-01
      • 2012-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多