- List all file versions
- Get file version
- Remove file version
- Restore file version
- Promote file version
Retrieve a list of the past versions for a file.
Versions are only tracked by Box users with premium accounts. To fetch the ID
of the current version of a file, use the GET /file/:id
API.
This operation is performed by calling function GetFileVersions
.
See the endpoint docs at API Reference.
await client.FileVersions.GetFileVersionsAsync(fileId: file.Id);
- fileId
string
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
https://*.app.box.com/files/123
thefile_id
is123
. Example: "12345"
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
- queryParams
GetFileVersionsQueryParams
- Query parameters of getFileVersions method
- headers
GetFileVersionsHeaders
- Headers of getFileVersions method
- cancellationToken
System.Threading.CancellationToken?
- Token used for request cancellation.
This function returns a value of type FileVersions
.
Returns an array of past versions for this file.
Retrieve a specific version of a file.
Versions are only tracked for Box users with premium accounts.
This operation is performed by calling function GetFileVersionById
.
See the endpoint docs at API Reference.
await client.FileVersions.GetFileVersionByIdAsync(fileId: file.Id, fileVersionId: NullableUtils.Unwrap(fileVersions.Entries)[0].Id);
- fileId
string
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
https://*.app.box.com/files/123
thefile_id
is123
. Example: "12345"
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
- fileVersionId
string
- The ID of the file version Example: "1234"
- queryParams
GetFileVersionByIdQueryParams
- Query parameters of getFileVersionById method
- headers
GetFileVersionByIdHeaders
- Headers of getFileVersionById method
- cancellationToken
System.Threading.CancellationToken?
- Token used for request cancellation.
This function returns a value of type FileVersionFull
.
Returns a specific version of a file.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
Move a file version to the trash.
Versions are only tracked for Box users with premium accounts.
This operation is performed by calling function DeleteFileVersionById
.
See the endpoint docs at API Reference.
await client.FileVersions.DeleteFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id);
- fileId
string
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
https://*.app.box.com/files/123
thefile_id
is123
. Example: "12345"
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
- fileVersionId
string
- The ID of the file version Example: "1234"
- headers
DeleteFileVersionByIdHeaders
- Headers of deleteFileVersionById method
- cancellationToken
System.Threading.CancellationToken?
- Token used for request cancellation.
This function returns a value of type null
.
Returns an empty response when the file has been successfully deleted.
Restores a specific version of a file after it was deleted. Don't use this endpoint to restore Box Notes, as it works with file formats such as PDF, DOC, PPTX or similar.
This operation is performed by calling function UpdateFileVersionById
.
See the endpoint docs at API Reference.
await client.FileVersions.UpdateFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id, requestBody: new UpdateFileVersionByIdRequestBody() { TrashedAt = null });
- fileId
string
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
https://*.app.box.com/files/123
thefile_id
is123
. Example: "12345"
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
- fileVersionId
string
- The ID of the file version Example: "1234"
- requestBody
UpdateFileVersionByIdRequestBody
- Request body of updateFileVersionById method
- headers
UpdateFileVersionByIdHeaders
- Headers of updateFileVersionById method
- cancellationToken
System.Threading.CancellationToken?
- Token used for request cancellation.
This function returns a value of type FileVersionFull
.
Returns a restored file version object.
Promote a specific version of a file.
If previous versions exist, this method can be used to promote one of the older versions to the top of the version history.
This creates a new copy of the old version and puts it at the
top of the versions history. The file will have the exact same contents
as the older version, with the the same hash digest, etag
, and
name as the original.
Other properties such as comments do not get updated to their former values.
Don't use this endpoint to restore Box Notes, as it works with file formats such as PDF, DOC, PPTX or similar.
This operation is performed by calling function PromoteFileVersion
.
See the endpoint docs at API Reference.
await client.FileVersions.PromoteFileVersionAsync(fileId: file.Id, requestBody: new PromoteFileVersionRequestBody() { Id = NullableUtils.Unwrap(fileVersions.Entries)[0].Id, Type = PromoteFileVersionRequestBodyTypeField.FileVersion });
- fileId
string
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
https://*.app.box.com/files/123
thefile_id
is123
. Example: "12345"
- The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL
- requestBody
PromoteFileVersionRequestBody
- Request body of promoteFileVersion method
- queryParams
PromoteFileVersionQueryParams
- Query parameters of promoteFileVersion method
- headers
PromoteFileVersionHeaders
- Headers of promoteFileVersion method
- cancellationToken
System.Threading.CancellationToken?
- Token used for request cancellation.
This function returns a value of type FileVersionFull
.
Returns a newly created file version object.