How to keep deleted emails for longer in Outlook via Exchange Online

keep deleted emails for longer in Outlook

If you have a ton of emails in your Perspective account that just needs to go, you can have them permanently deleted. They must then be moved to the folder, Recoverable Items> Deletions, where they will be held for 14 days. However, if 14 days are not enough, why not increase it up to 30 days? Yes, it is possible.

According to the title, it is clear that you will need to have a Microsoft Exchange Online account, so if you are a home user, then the chances are that this article is not for you, but at the same time you can continue to read in order to learn something new.

Before we go forward, we must emphasize that you must use Exchange Online PowerShell because, for the moment, it is not possible to make the necessary modifications from Outlook or Outlook on the Web. It's strange, but that's what it is. So, until Microsoft makes changes, we have to work with what is available.

READ  Top 7 Fixes for Gmail Not Receiving Emails on iPhone

How to keep deleted emails permanently longer

For whatever reason, you may want to keep the deleted emails a little longer, and this guide will help you accomplish this task. We will cover the following points:

  1. Select the appropriate permissions
  2. Connect Windows PowerShell to Exchange Online
  3. Disconnect the remote PowerShell session

1) Select the appropriate permissions

The first thing is the first, and it is to assign the permissions that make sense for this specific problem. To do this, you must visit and check the section, Recipient Provisioning Authorizationsand assign the one listed below to your Exchange Online server.

2) Connect Windows PowerShell to Exchange Online

keep deleted emails longer in Outlook

For things to work, we must first connect your Exchange Online server to Windows PowerShell. We can do this by running PowerShell from your local computer, and then copy and paste the following command:

$UserCredential = Get-Credential

When the dialog box appears, please enter your school or work account, then your password, and click OK. The next step is then to copy and paste another command, and this happens as follows, here:

READ  Download Lenovo Z6 Youth Edition Wallpapers

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

Also run this command after performing the previous one:

Import-PSSession $Session -DisableNameChecking

3) Disconnect the remote PowerShell session

Once done, we suggest that you do not close Windows PowerShell permanently, but disconnect it. You see, if you close the window, you can use all the available remote PowerShell sessions, and you will have to wait for the sessions to expire.

To disconnect the session, copy and paste the following command, and then run it by pressing the Enter key:

Remove-PSSession $Session

4) Change the retention period of deleted items permanently

Now it's time to do what you came here first, so please restart Windows PowerShell, then type the following command in the box and press Enter:

READ  How to disable ‘Auto backup your files to OneDrive’ notification in Windows 10

Set-Mailbox -Identity "Emily Maier" -RetainDeletedItemsFor 30

Keep in mind that this command is for a specific mailbox. Please remove Emily Maier and replace it with the name of your favorite mailbox. In addition, this command will set the deletion date to 30 days.

To make changes to all mailboxes, please copy and paste the following:

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Set-Mailbox -RetainDeletedItemsFor 30

OK, so that's it and we're done. If you need more information, visit

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top