If you want to extend the email retention policy for deleted items in Microsoft 365, here is how you can do that. Although permanently deleted items are stored for 14 days in the Deletions folder, you can increase or decrease the number of days as per your requirements with the help of the Exchange Online PowerShell module.
It’s really a terrible feeling when you know the email or a calendar Invite you are trying to find was flushed out of the mailbox through a retention policy. Every email service is operated by a Retention Policy that deletes items automatically from the ‘Delete’ folder after a certain period of time (30 days).
Before you get started, you need to know that you must have the Exchange Online PowerShell module installed. For your information, you can download it from learn.microsoft.com and it is compatible with PowerShell 7 on Windows PC.
How to Extend Email Retention Policy for Deleted Items in Microsoft 365
To extend the email retention policy for deleted items in Microsoft 365, follow these steps:
- Open the Exchange Online PowerShell window.
- Enter this command: Set-Mailbox -Identity “name” -RetainDeletedItemsFor <days>
- Enter this command to change the policy for all users: Get-Mailbox -ResultSize unlimited -Filter “RecipientTypeDetails -eq ‘UserMailbox'” | Set-Mailbox -RetainDeletedItemsFor <days>
To learn more about these steps, continue reading.
To get started, you need to open the Exchange Online PowerShell window first. For that, you can enter this command to connect:
Connect-ExchangeOnline -UserPrincipalName <Your-UPN>
Don’t forget to replace Your-UPN with your actual User Principle Name.
Once you are connected to Exchange Online, enter this command:
Set-Mailbox -Identity "name" -RetainDeletedItemsFor <days>
Let’s assume that you have an account in the name of John and you want to set the days to 20. In that case, the command will look like this:
Set-Mailbox -Identity "John" -RetainDeletedItemsFor 20
This command applies the policy to only one mailbox. However, if you want to apply the same policy for all existing mailboxes, you need to enter this command:
Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'UserMailbox'" | Set-Mailbox -RetainDeletedItemsFor 20
Here, you can change 20 with anything you like as long as it doesn’t exceed the 30-day limit.
If you want to verify whether the policy has been set correctly or not, enter this command:
Get-Mailbox <John> | Format-List RetainDeletedItemsFor
This command shows if the policy has been set correctly for John’s mailbox. If you want to check the same for all mailboxes, enter this command:
Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'UserMailbox'" | Format-List Name,RetainDeletedItemsFor
However, there could be times when you might want to apply the same policy to all the mailboxes except one or two. In that case, you need to put that mailbox on In-Place Hold or Litigation Hold.
Create custom Email Retention Policy
You can either edit the name of the Default MRM Policy or create a new policy to opt out of this change. To change the policy name in Microsoft 365, navigate to Microsoft 365 Admin, choose Exchange Admin Center, and select the compliance management option. Next, look for the ‘retention policies’ option.
Next, select Default MRM Policy, click the edit icon, and then change the name of the policy. Once done, Microsoft 365 will maintain the settings you’ve specified and your policy will not be overwritten.
If you have customized your Default MRM Policy and kept the original name, the change will still apply.
Kindly note that the changes you make will not apply to the Recoverable Items folder. It will be only for the visible Deleted Items folder and for the Deleted Items folder in both the primary and archive mailbox. It will also not affect any “Move to Archive” actions on the Deleted Items folder.
Email missing from the Deleted Items folder
If you find or notice that messages older than 30 days do not appear under the Deleted Items folder of an Exchange Online user’s mailbox you can try the following as a workaround.
- Increase the number of days in the custom retention policy.
- Assign the Default MRM Policy to the mailbox.
- Change the name for the retention policy that’s assigned to the mailbox to “Default MRM Policy.
Final words: Every organization has its own set of business requirements, compliance and legal rules, and general culture of how email is consumed. Administrators must confirm that this change remains in line with existing compliance rules and if not, make all the changes appropriately. They also need to take a look at the potential impact on the amount of new data that will be downloaded by Microsoft 365 clients.
Read: How to recover deleted Yahoo & Gmail emails from Trash
How do I change the retention policy for deleted items in Office 365?
You need to use the Exchange Online PowerShell module to change the retention policy for deleted items in Microsoft 365. Install and open PowerShell and enter this command: Set-Mailbox -Identity “name” -RetainDeletedItemsFor <days>. If you want to extend the retention policy for all mailboxes, enter this command: Get-Mailbox -ResultSize unlimited -Filter “RecipientTypeDetails -eq ‘UserMailbox'” | Set-Mailbox -RetainDeletedItemsFor <days>.
How long does Office 365 retain deleted emails?
If an item is placed in the Recoverable Items > Deletions, it stays there for 14 days. However, it is possible to change the policy to 30 days. On the other hand, you can put a mailbox on In-Place Hold or Litigation Hold to recover deleted items longer than 30 days.