【问题标题】:Publish the slides file using apps script slide (GAS) service使用应用程序脚本幻灯片 (GAS) 服务发布幻灯片文件
【发布时间】:2020-09-03 05:33:18
【问题描述】:

我需要将幻灯片文件发布到网站并获取发布的 URL,但我没有将发布的 URL 作为返回响应。

云端硬盘服务已开启。

我试过了

function doGet(e) {    
  var ppt = SlidesApp.openByUrl('https://docs.google.com/presentation/d/1fIQpQJ8QaIqt3fibTGmlAndZuvDG3ry8maAm_0CgSLE/edit#slide=id.p');
  var fileId = ppt.getId();
  var revisions = Drive.Revisions.list(fileId); 
  var items = revisions.items; 
  var revisionId =items[items.length-1].id; 
  var resource = Drive.Revisions.get(fileId, revisionId); 
  resource.publishAuto = true;
  resource.publishedOutsideDomain = true;
  resource.published = true;    
  return ContentService.createTextOutput(JSON.stringify(Drive.Revisions.update(resource, fileId, revisionId).publishedLink));
}

【问题讨论】:

  • 调试细节?日志?时间戳相关?查看> 处决?
  • 如果我使用上面的代码,它的空白输出
  • 我如何获得发布链接?
  • Edit 显示console.log(JSON.stringify(Drive.Revisions.update(resource, fileId, revisionId).publishedLink)))的输出
  • 我看到json根本没有这个属性。但文件说它有。希望你能复制这个问题吗?

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


【解决方案1】:

这可能是一个错误:

未填充来自已发布 Revision(至少对于表格、文档和幻灯片)的 publishedLink。 V2 和 V3 似乎都是这种情况。

此行为已在问题跟踪器中报告过:

我建议您为该问题加注星标,以使其更具可见性。

在这种情况下,我认为一种解决方法可能是改用修订版exportLinks 之一。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-21
    • 2019-01-23
    • 1970-01-01
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    相关资源
    最近更新 更多