【问题标题】:Attach PDF using Apps Script from Shared Drive使用共享驱动器中的 Apps 脚本附加 PDF
【发布时间】:2020-08-18 20:46:29
【问题描述】:

我需要使用 MailApp.sendEmail 将文件附加到邮件中 我遇到的问题是我无法从共享驱动器中附加任何内容,只能从个人驱动器中附加任何内容。 我想使用共享驱动器来选择要附加的文件。

有人知道这是否可能吗?

更新: 这是用于打开选择器的代码,目前仅适用于运行脚本的用户的个人驱动器:

function createPicker(token) {
  if (pickerApiLoaded && token) {
    var picker = new google.picker.PickerBuilder()
        // Instruct Picker to display all PDFs in Drive. For other
        // views, see https://developers.google.com/picker/docs/#otherviews
        .addView(google.picker.ViewId.PDFS)
        // Hide the navigation panel so that Picker fills more of the dialog.
        .enableFeature(google.picker.Feature.NAV_HIDDEN)
        // Hide the title bar since an Apps Script dialog already has a title.
        .hideTitleBar()
        .setOAuthToken(token)
        .setCallback(pickerCallback)
        .setOrigin(google.script.host.origin)
        // Instruct Picker to fill the dialog, minus 2 pixels for the border.
        .setSize(DIALOG_DIMENSIONS.width - 2,
            DIALOG_DIMENSIONS.height - 2)
        .build();
    picker.setVisible(true);
  } else {
    showError('Unable to load the file picker.');
  }
}

我想对此进行编辑,以便访问共享云端硬盘。我发现了一些使用 GDrive API 访问共享驱动器(也使用选择器)的东西,但我错过了成功编辑它的体验。

这就是我的意思:https://developers.google.com/drive/api/v3/enable-shareddrives

【问题讨论】:

  • 欢迎来到 SO,如果你能展示你到目前为止尝试过的代码会很有帮助
  • 这可以通过使用 Drive Advanced Service 来实现。
  • 这能回答你的问题吗? Accessing Files and Folders in Team Drive
  • 嗨,很抱歉不清楚。我已经更新了我的 OP。

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


【解决方案1】:

没关系,应该搜索更多。很抱歉浪费您的时间,谢谢您的回答!

我使用的解决方案对我有用:

google apps script, google picker for team drive

【讨论】:

    猜你喜欢
    • 2020-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-23
    • 1970-01-01
    • 2020-07-27
    • 1970-01-01
    相关资源
    最近更新 更多