It's good to go through the Exchange Hybrid test plan checklist and test all the…
Change Exchange Online deleted items retention period
When a user deletes items from the Deleted Items default folder by using the Delete, Shift+Delete, or Empty Deleted Items Folder actions; the items are moved to the Recoverable Items\Deletions folder. The duration that deleted items remain in this folder is based on the deleted item retention settings configured for the mailbox. A mailbox is configured to retain deleted items for 14 days by default. In this article, we will show how to change the recoverable items\deletetion folder to a maximum of 30 days.
Table of contents
Recover deleted items
When the user deletes a mailbox item such as an email message, a contact, a calendar appointment, or a task in Outlook and Outlook on the web, the item will go to the Deleted Items folder.
A mailbox item is deleted and moved to the Recoverable Items folder when a user does one of the following:
- Deletes an item from the Deleted Items folder
- Empties the Deleted Items folder
- Permanently deletes an item by selecting it and pressing Shift+Delete
Check recover deleted items
To check the Recover Deleted Items in Outlook:
- Start Outlook
- Click on Deleted Items
- Select Recover items recently removed from this folder
The Recover Deleted Items window will appear with the deleted messages and the date the user deleted them.
Note: The deleted items in the recovery folder are 14 days, and the maximum limit you can set is 30 days. You can restore and purge one item, multiple items, or all items.
Change deleted items retention period for single mailbox
Connect to Exchange Online PowerShell. Run the Get-Mailbox cmdlet to check the deleted items retention period for the single user.
The retention period for the user is set for 14 days, which is the default.
PS C:\> Get-Mailbox "amanda.morgan@exoip.com" | ft Name,RetainDeletedItemsFor
Name RetainDeletedItemsFor
---- ---------------------
Amanda Morgan 30.00:00:00
Run the Set-Mailbox cmdlet to set the deleted items retention period for a single user.
PS C:\> Set-Mailbox "amanda.morgan@exoip.com" -RetainDeletedItemsFor "30"
In the next step, we will look at how to extend the deleted items retention period for all the users
Change deleted items retention period for all mailboxes
Run the Get-Mailbox cmdlet to check the deleted items retention period for all users.
PS C:\> Get-Mailbox -ResultSize Unlimited | ft Name,RetainDeletedItemsFor
Name RetainDeletedItemsFor
---- ---------------------
Amanda Morgan 30.00:00:00
Neil Graham 14.00:00:00
Amelia Nash 14.00:00:00
Curt Berry 14.00:00:00
Thomas Wilkins 14.00:00:00
Craig Hansen 14.00:00:00
Run the Set-Mailbox cmdlet to set the deleted items retention period for all mailboxes.
PS C:\> Get-Mailbox -ResultSize Unlimited | Set-Mailbox -RetainDeletedItemsFor "30"
Suppose you only want to set the retention period for all the user mailboxes.
PS C:\> Get-Mailbox -ResultSize Unlimited -Filter "RecipientTypeDetails -eq 'UserMailbox'" | Set-Mailbox -RetainDeletedItemsFor "30"
Configure mailbox plan deleted items retention
The above commands only apply to existing mailboxes. So if you create new user mailboxes, the default items retention period is set to the default 14 days.
Note: The global configuration for the deleted items retention period is stored in the Mailbox Plans assigned to the mailboxes.
Run the Get-MailboxPlan cmdlet to check the retained deleted items for value.
PS C:\> Get-MailboxPlan | ft Name, RetainDeletedItemsFor
Name RetainDeletedItemsFor
---- ---------------------
ExchangeOnline-c958f8fd-de76-4fa7-8753-b02d2582655c 14.00:00:00
ExchangeOnlineDeskless-3d2415cd-6a13-45e1-b89d-6bdb7d147cd2 14.00:00:00
ExchangeOnlineEnterprise-5c9153a0-13db-4e32-95e6-0725fe1cab7d 14.00:00:00
ExchangeOnlineEssentials-87425ef5-91d7-4dd5-b133-5c6e96c0daf1 14.00:00:00
Change the Mailbox Plan to 30 days so new user creation will have the deleted items retention period automatically set for 30 days.
PS C:\> Get-MailboxPlan | Set-MailboxPlan -RetainDeletedItemsFor "30"
Note: The above change will only apply to new mailboxes. You still have to modify the deleted items retention period for existing mailboxes with the Set-Mailbox cmdlet, as shown in the first section.
You successfully did configure the mailbox plan to retain deleted items for 30 days.
Read more: Permanently delete users from Office 365 »
Conclusion
You learned how to change Exchange Online deleted items retention period with PowerShell. First, change the mailbox retention period for a single mailbox or all mailboxes. I recommend setting the deleted retention items for all mailboxes. After that, configure the mailbox plan retention deleted items for 30 days so new mailbox creation will have this 30-day setting automatically applied.
Did you enjoy this article? You may also like Reset Office 365 delegate access with PowerShell. Don’t forget to follow us and share this article.
This Post Has 0 Comments