如果文件是在 Google Workspace 网域中创建的,则 publishedOutsideDomain 属性会指明相应修订版本是否可供所有人访问,或者是否仅限网域用户访问。对于 Google 协作平台文件,此属性表示是否存在 type=anyone 权限。如需了解详情,请参阅 permissions 资源中的 type 字段。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Manage file revisions\n\nThis guide explains how to use the [`revisions`](/workspace/drive/api/reference/rest/v3/revisions)\nresource to manage file revisions, such as getting a file revision and\npublishing a Google Workspace revision. The Google Drive API also lets you\ndownload revisions. For more details about revision terminology, see [Changes\nand revisions overview](/workspace/drive/api/guides/change-overview).\n\nTo access the revision history, a user must have the `role` of `owner`,\n`organizer`, `fileOrganizer`, or `writer`.\n\nTo specify the fields to return in the response, you can set the `fields`\n[system parameter](https://cloud.google.com/apis/docs/system-parameters#definitions)\nwith any method of the [`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource. If\nyou omit the parameter, the server returns a default set of fields. For example,\nthe `revisions.list` method only returns the `id`, `mimeType`, `kind`, and\n`modifiedTime` fields. To return different fields, see [Return specific fields](/workspace/drive/api/guides/fields-parameter).\n\nSpecify revisions to save from auto delete\n------------------------------------------\n\nGoogle Drive automatically deletes older revisions that are no longer of\ninterest to the user.\n\nA [blob](/workspace/drive/api/guides/about-files#types) file revision can be set to \"Keep\nForever\" meaning the revision cannot be automatically purged. Up to 200\nrevisions can be set to \"Keep Forever\" and they count towards your storage\nlimit. The head revision is never auto-purged.\n\nAny blob file revision, other than the head revision, that's not designated as\n\"Keep Forever\" is purgeable. Purgeable revisions are typically preserved for 30\ndays, but can be purged earlier if a file has 100 revisions that aren't\ndesignated as \"Keep Forever\" and a new revision is uploaded.\n\nYou can set the boolean `keepForever` field of the [`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource to `true` to mark revisions that you\ndon't want Drive to purge. Once a blob file revision is set to\n\"Keep Forever\", it can only be downloaded or deleted. For more information, see\n[Download a revision](#download-revision) or [Delete a\nrevision](#delete-file-revision).\n\nIf you're using the older Drive API v2, use the [`pinned`](/workspace/drive/api/reference/rest/v2/revisions#Revision.FIELDS.pinned) field of the\n[`revisions`](/workspace/drive/api/reference/rest/v2/revisions) resource instead of\n`keepForever`.\n\nGet a file revision\n-------------------\n\nTo get a file revision's metadata or content, use the [`get`](/workspace/drive/api/reference/rest/v3/revisions/get) method on the\n[`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource with the `fileId` and\n`revisionId` path parameters. If you don't know the revision ID, you can [list\nall revisions on a file](#list-file-revisions) using the `list` method.\n\nThe method returns the revision's metadata as an instance of a `revisions`\nresource.\n\nTo acknowledge the risk of downloading known malware or other\n[abusive](https://support.google.com/docs/answer/148505) files, set the\n`acknowledgeAbuse` query parameter to `true`. This field is only applicable when\nthe `alt=media` parameter is set and the user is either the file owner or an\norganizer of the shared drive in which the file resides.\n\nList a file's revisions\n-----------------------\n\nTo list a file's revisions, use the [`list`](/workspace/drive/api/reference/rest/v3/revisions/list)\nmethod on the [`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource with the\n`fileId` path parameter. The method returns a list of file revisions.\n\nPass the following query parameters to customize pagination of, or filter,\nrevisions:\n\n- `pageSize`: The maximum number of revisions to return per page.\n\n- `pageToken`: A page token, received from a previous list call. Provide this\n token to retrieve the subsequent page.\n\nUpdate a file revision\n----------------------\n\nTo update a revision on a file, use the\n[`update`](/workspace/drive/api/reference/rest/v3/revisions/update) method on the [`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource with the `fileId` and `revisionId` path\nparameters.\n\nThe method returns an instance of a `revisions` resource.\n\nDownload a revision\n-------------------\n\nYou can only download blob file content revisions marked as \"Keep Forever\". If\nyou want to download a revision, make sure to set it to \"Keep Forever\" first.\nFor more information, see [Specify revisions to save from auto\ndelete](#specify-revisions).\n\nTo download a blob file content revision or to export a Google Workspace\ndocument content revision, see [Download and export\nfiles](/workspace/drive/api/guides/manage-downloads).\n\nDelete a file revision\n----------------------\n\nTo permanently delete a file revision, use the\n[`delete`](/workspace/drive/api/reference/rest/v3/revisions/delete) method on the [`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource with the `fileId` and `revisionId` path\nparameters.\n\nYou can only delete revisions for blob files with binary content in\nDrive, such as images, videos, and PDFs. You can delete a blob\nfile revision when it's marked as \"Keep Forever.\" Revisions for other files,\nsuch as a Google Docs or Sheets, and the last remaining\nrevision of the binary file, can't be deleted.\n\nPublish a revision\n------------------\n\nTo publish a Google Docs, Google Sheets, and Google Slides revision, set\nthe `published` property for that file in the\n[`revisions`](/workspace/drive/api/reference/rest/v3/revisions) resource. This property can't be set\nfor Google Sites revisions using Drive API.\n\nPublished revisions don't reflect changes made to a file unless the\n`publishAuto` property is set. If the property is set to `true`, newer revisions\nof a file are automatically published, overwriting the previous ones.\nSlides and Drawings only support automatic\nre-publishing and require the `publishAuto` property to be set to `true`. For\nSites files, `publishAuto` is always `false`.\n\nIf the file is created in a Google Workspace domain, the\n`publishedOutsideDomain` property indicates whether the revision is accessible\nby anyone or if it's restricted to users of the domain. For Sites\nfiles, this property indicates whether a `type=anyone` permission exists. For\nmore information, see the\n[`type`](/workspace/drive/api/reference/rest/v3/permissions#Permission.FIELDS.type) field on the\n`permissions` resource.\n\nAutomatic publishing is also controlled by the \"Automatically republish when\nchanges are made\" checkbox in the UI of Docs and\nSheets. For more information, see [Make Google Docs,\nSheets, Slides \\& Forms\npublic](https://support.google.com/docs/answer/183965).\n\nRelated topics\n--------------\n\n- [Download and export files](/workspace/drive/api/guides/manage-downloads)\n- [Roles and permissions](/workspace/drive/api/guides/ref-roles)"]]