# ArchiveOldVersionsJob

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Reference](https://developer.m-files.com/APIs/gRPC-API/Reference/index.md) > [Messages](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ArchiveOldVersionsJob/

Struct for a job of archiving old versions of documents.

- **Full name:** `MFiles.ArchiveOldVersionsJob`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)

<a id="fields"></a>

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-must_be_marked_for_archiving"></a>`must_be_marked_for_archiving` | `bool` | 1 | Condition: Document is marked for archiving. False = condition not effective. |
| <a id="f-must_be_checked_in_before_utc"></a>`must_be_checked_in_before_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | 2 | If bCheckedInBefore is true, specifies the condition parameter. |
| <a id="f-has_must_be_at_least_nversions_older"></a>`has_must_be_at_least_nversions_older` | `bool` | 3 | Condition: At least N versions older than the current version. False = condition not effective. |
| <a id="f-must_be_at_least_nversions_older"></a>`must_be_at_least_nversions_older` | `int32` | 4 | If bAtLeastNVersionsOlder is true, specifies the condition parameter. |
| <a id="f-has_must_be_at_least_ndays_older"></a>`has_must_be_at_least_ndays_older` | `bool` | 5 | Condition: At least N days older than the current version. False = condition not effective. |
| <a id="f-must_be_at_least_ndays_older"></a>`must_be_at_least_ndays_older` | `int32` | 6 | If bAtLeastNDaysOlder is true, specifies the condition parameter. |
| <a id="f-must_not_have_version_tag"></a>`must_not_have_version_tag` | `bool` | 7 | Condition: Has no version tag. False = condition not effective. |
| <a id="f-target_file"></a>`target_file` | `string` | 8 | Full path to the target file on server. |
| <a id="f-impersonation"></a>`impersonation` | [`Impersonation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Impersonation/index.md) | 9 | Impersonation information for accessing the archive target files on server. |
| <a id="f-options"></a>`options` | [`OBJARCHIVINGFLAGS`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.OBJARCHIVINGFLAGS/index.md) | 10 | Bit flags that control the execution of this archiving job. Note: Currently only OBJARCHIVINGFLAG_OVERWRITEEXISTINGFILES, OBJARCHIVINGFLAG_DESTROYAFTERWARDS, and OBJARCHIVINGFLAG_RESETMFA are supported. |

<a id="used-by-methods"></a>

## Used by methods

- [IRPCVaultAdmin.ArchiveOldVersions](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ArchiveOldVersions/index.md): Archives old versions of documents that meet the job's conditions into an archive file on the server, or previews how many would be archived.

<a id="used-in-fields"></a>

## Used in fields

- [`JobDataUnion.archive_old_versions`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.JobDataUnion/index.md#f-archive_old_versions): Archiving old document versions job.
- [`ArchiveOldVersionsRequest.archivejob`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultAdmin/ArchiveOldVersions/index.md#request): The conditions that select the old versions, the target file on the server and the archiving options.
