Data retention policies

Backing up your Exchange and SharePoint data can quickly use up the available storage space, no matter how large it is. To keep your storage growth under control and avoid situations when all your local drives are full, CodeTwo Backup comes with data retention policies and archiving functionality. Retention policies automatically delete data that doesn’t meet the retention criteria, whereas archiving creates a snapshot copy of the storage on an external drive.


To learn more about archiving, see this article.

There are two types of retention policies available in CodeTwo Backup: storage retention policy and archive retention policy. The key differences between them are described in detail in the relevant sections:

Storage retention policy

Data retention policy is defined separately for each backup storage in the storage configuration wizard. You can also configure the frequency with which the retention policy is executed in the Retention scheduler step. If data archiving has been configured for a specific storage, the retention process is always paused when the archive job is running.

Data retention policy vs. data archiving

Always remember to configure an archive job for the storage that makes use of the retention policy. If you fail to do so, eventually all versions of an item will be gradually removed from the storage when they reach their retention age.

Backup storages may contain two types of data: Exchange (such as mailboxes, including SharePoint site mailboxes, and public folders) and SharePoint (site collections, team sites, and OneDrive for Business sites). For that reason, the storage retention policy is further divided into two types:

Exchange data retention

CodeTwo Backup supports item versioning, so if you run a one-time backup job several times or use a continuous backup job, there may be many cases where you will have multiple versions of the same item in a single storage, backed up at different points in time. The goal of the Exchange data retention policy is to keep only the most recent version of an item. This is achieved by deleting those versions that are older than the value defined in the retention settings.


The age of an item is calculated based on the date when the item (or its version) was backed up in the storage, not on the date when the item was originally created on the Exchange server / in Office 365.

When enabled, the Exchange data retention policy by default applies only to emails and journal entries. You can easily include other types of items, such as contacts, tasks or calendar entries. Before extending the policy to these item types, keep in mind that many users do not modify the contacts and calendar items very often. As a result, there may be only one version of such an item in the storage.

The Exchange data retention policy can also be separately enabled for special folders (e.g. deleted items). When you turn it on, all items stored in special folders (e.g. emails, calendar items, journals, etc.) will be removed after reaching a defined age, regardless of their type.

Other aspects of Exchange data retention policy:

  • Default folders (e.g. Inbox) are never deleted.
  • The retention policy applies to folders as well.
  • Custom folders are deleted only when all items and subfolders reach their retention age.

SharePoint data retention

Just like in the case of Exchange data, CodeTwo Backup creates different versions of SharePoint items with each backup cycle (backup versions), provided these items have been modified on the source server between subsequent cycles. Additionally, if you use versioning for your SharePoint libraries, CodeTwo Backup will back up all existing SharePoint versions of items kept in such libraries. The SharePoint data retention policy allows you to control the storage space by deleting older backup versions of list and library items as well as older SharePoint versions of library items.

Keep in mind that by default the program will keep at least one backed-up version of any SharePoint item (or item version). However, it is also possible to configure the retention policy to delete all item versions if the given item has been deleted from its original list or library on the source SharePoint server.

The SharePoint data retention policy settings allow you to specify:

  • The number of days that need to pass after an item has been deleted from the SharePoint server before that same item is deleted from the backup storage (minimum 1 day).
  • The maximum number of backed-up item versions that should be kept in the storage (minimum 1). If there are more such versions, the oldest one will be deleted.
  • The maximum number of SharePoint versions of a library item that should be kept in the storage (minimum 1). If there are more such versions, the oldest one will be deleted. Based on this setting, the program will also backup up the set number of SharePoint versions of library items. 


The deletion date is based on the date the program has marked SharePoint items as deleted in the storage, not the date when these items were actually deleted from the SharePoint server. This means that if you perform backups once a week, it is possible that the backed-up list or library items will be marked as deleted up to 7 days after they were deleted from SharePoint.

SharePoint objects, such as sites, lists, libraries, folders or OneNote notebooks are never deleted from the storage, even if they contain no items. However, when empty, these objects are hidden, which means they will not be visible on the Backups tab while you are browsing through the backed-up data.


You applied the following retention policy for the SharePoint data backed up in your storage (Fig. 1.):

  • Keep the backed-up items for 30 days after they have been deleted from SharePoint.
  • Keep a maximum of 2 latest backed-up item versions.
  • Keep a maximum of 3 latest SharePoint versions for each backed-up version of a library item.

SharePoint retention policy settings in CodeTwo Backup
Fig. 1. SharePoint retention policy settings in CodeTwo Backup.

The illustration below (Fig. 2.) shows how these settings affect the behavior of SharePoint data retention functionality in CodeTwo Backup. For simplicity, the illustration shows a backup and retention process involving a single library item.

Backup - SharePoint data retention explained
Fig. 2. Retention scheme used in CodeTwo Backup.

Archive retention policy

Archive retention policy is configured in the archive and PST archive job wizards. It defines how many versions of an archive will be kept and what CodeTwo Backup should do when the disk space where your archive is located is running low. You can configure the archive job to do nothing, and in such a case the archive process will stop and generate an alert on the Dashboard tab. You can also instruct the program to delete the oldest version of the archive to make sure that the archiving process continues.

Before setting up the archive retention policy, consider the following limitations:

  • There is no option to archive only selected mailbox items, public folders or sites. The entire Exchange and SharePoint data (from on-premises environments as well as Office 365) contained in the storage will be archived.
  • Since external drives may not always be available for the CodeTwo Backup Service, the archive retention policy process is not constantly running in the background. Retention policies for archives are checked and executed only when an archive job is started. We recommend configuring the scheduler so that archiving starts automatically at specified times (learn more).

In this article

Was this information useful?