如果檔案是在 Google Workspace 網域中建立,則 publishedOutsideDomain 屬性會指出修訂版本是否可供所有人存取,或僅限網域使用者存取。如果是 Google 協作平台檔案,這項屬性會指出是否存在 type=anyone 權限。詳情請參閱 permissions 資源的 type 欄位。
此外,您也可以在 Google 文件和試算表的 UI 中,透過「內容有所變更時自動重新發布」核取方塊,控管自動發布功能。詳情請參閱「公開 Google 文件、試算表、簡報和表單」。
[[["容易理解","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"]],["上次更新時間: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)"]]