【发布时间】:2016-12-06 10:38:24
【问题描述】:
我想将我的 pdf、照片和其他非 GDoc 文件的所有修订保存在我的 Google 云端硬盘上。为此,我想使用 Google Apps 脚本。
那么我怎样才能获得所有的文件及其修订版?
【问题讨论】:
标签: google-apps-script google-drive-api
我想将我的 pdf、照片和其他非 GDoc 文件的所有修订保存在我的 Google 云端硬盘上。为此,我想使用 Google Apps 脚本。
那么我怎样才能获得所有的文件及其修订版?
【问题讨论】:
标签: google-apps-script google-drive-api
如果您从 Resources > Advanced Google Services 启用 Drive API,则可以使用 API 的 revisions 部分。例如:
var fileId = '<...id...>';
// Retrieve list of revisions - specify that the modifiedDate and download
// URL are required.
var response = Drive.Revisions.list(fileId, {fields:'items(downloadUrl,modifiedDate)'});
var revisions = JSON.parse(response);
var items = revisions.items;
// e.g. Inspect first item
var firstItem = items[0];
Logger.log(firstItem.downloadUrl);
Logger.log(firstItem.modifiedDate);
/*
https://...etc
2016-11-28T21:58:56.650Z
*/
【讨论】: