该文档描述了如何复制一个文件 ( https://developers.google.com/drive/api/v2/reference/files/copy ),但没有提及该文件夹。此脚本在复制文件夹时会出现错误 403:
window.gapi.client.drive.files
.create({
resource: {
name: this.currentFile.newTitle,
mimeType: 'application/vnd.google-apps.folder'
},
fields: 'id, name, mimeType, createdTime'
}).then(res => {
window.gapi.client.drive.files.list({
q: `'${this.currentFile.id}' in parents and trashed = false`,
fields: 'files(id, name, createdTime, mimeType)'
}).then(res => {
console.log(res)
res.result.files.forEach(file => {
window.gapi.client.drive.files
.copy({
fileId: file.id,
fields: 'id, name, mimeType, createdTime'
}).then(res => console.log(res))
})
})
})
我尝试了在 Internet 上找到的其他解决方案,但它们也不起作用。您能否附上一些适合您的示例代码?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句