google-apps-script - 使用共享驱动器中的 Apps 脚本附加 PDF
问题描述
我需要使用 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
解决方案
推荐阅读
- python - Django 教程:'detail' 不是有效的视图函数或模式名称
- python - 总结从 BeautifulSoup 导入的所有整数
- html - 在 Jekyll 上的 Liquid 中为导航创建“当前”链接
- django - Django:检查是否已加载外键字段
- java - Python/Java 中的版本比较器
- c# - 如何从 .NET Core 中的 Web API 响应中读取标头数据?
- c# - ASP.NET Core SQL Linq 使用字符串列表
- scala - Spark join *无* shuffle
- android - 如何在android studio 3.2.1版中从默认约束布局切换到相对布局
- javascript - 浏览器可以直接调用Oracle存储过程吗?