问题描述
我可以使用“我的云端硬盘”中的快捷方式或“我的云端硬盘”中的文件夹轻松创建Google文档文件的快捷方式。这个问题和答案How to create a shortcut in Google Drive Apps Script instead of multiple parents
对此提供了极大帮助但是,当我尝试对G Suite共享云端硬盘文件夹执行相同操作时,出现以下错误:
GoogleJsonResponseException:对drive.files.insert的API调用失败 出现错误:找不到文件:#FILE NUM
与“我的云端硬盘”一起使用,但不能与共享驱动器一起使用的代码是:
function createShortcut() {
const targetId = "TARGET DOCUMENT ID";
const shortcutName = "Test";
const folderId = "TARGET FOLDER ID";
const resource = {
shortcutDetails: { targetId: targetId },title: shortcutName,mimeType:"application/vnd.google-apps.shortcut",supportsTeamDrives:true,parents: [{id: folderId}]
};
const shortcut = Drive.Files.insert(resource);
}
我已经查阅了文档https://developers.google.com/drive/api/v3/shortcuts,但没有运气。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)