管理文件修订版本
Google Drive API 提供了 revisions
资源,以便您下载和发布文件修订版本。如需详细了解修订术语,请参阅更改和修订概览。
指定要保存以免被自动删除的修订版本
Google 云端硬盘会自动删除用户不再感兴趣的旧版本。为避免出现这种情况,您可以将布尔标志 keepRevisionForever
设置为 true
,以标记您不希望云端硬盘清除的修订版本。
下载修订版本
如需下载最新修订版,请使用 files.download
方法。如需了解详情,请参阅管理长时间运行的操作。
发布修订版
如需发布 Google 文档、Google 表格和 Google 幻灯片修订版,请在 revisions
资源中为相应文件设置 published
属性。无法使用 Drive API 为 Google 协作平台修订版本设置此属性。
Google 幻灯片和 Google 绘图不支持发布特定修订版。仅支持自动重新发布最新修订版。如需发布幻灯片和绘图,还应将 publishAuto
设置为 true
。
如果文件是在 Google Workspace 网域中创建的,publishedOutsideDomain
属性会指明相应修订版本是否可供任何人访问,还是仅限网域用户访问。对于网站文件,此属性指示是否存在 type=anyone
权限。
除非设置了 publishAuto
属性,否则已发布的修订版本不会反映对文件所做的更改。如果将该属性设为 true
,系统会自动发布文件的较新修订版,并覆盖之前的修订版。此行为还受云端硬盘界面中的“内容有改动时自动重新发布”复选框的控制。幻灯片和绘图仅支持自动重新发布,并且需要将 publishAuto
属性设为 true
。对于协作平台网站文件,publishAuto
始终为 false
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-21。
[null,null,["最后更新时间 (UTC):2024-12-21。"],[[["Google Drive API allows you to download and publish specific file revisions using the `revisions` resource."],["You can prevent Google Drive from automatically deleting older revisions by setting the `keepRevisionForever` flag to `true`."],["To download the latest revision of a file, utilize the `files.download` method."],["For Google Docs, Sheets, and Slides, publish a revision by setting the `published` property within the `revisions` resource, while Slides and Drawings require `publishAuto` set to `true` for automatic republishing of the latest revision."],["Published revisions are overwritten by newer ones if `publishAuto` is enabled, except for Sites files where `publishAuto` is always `false`."]]],[]]