Connect with us

Hi, what are you looking for?


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 email in your Outlook account that just needs to go, you can permanently have them deleted. They should then be moved to the folder, Recoverable Items > Deletions, where they will be kept for 14 days. However, if 14-days is not enough, then how about increasing it to up to 30-days? Yes, that is possible.

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

Before going forward, we must point out that you must use Exchange Online PowerShell since, at this time, it is not possible to make the changes needed from within Outlook or Outlook on the web. It’s odd, but it is what it is, so until Microsoft makes some changes, we have to work with what is available.

How to keep permanently deleted emails longer

For whatever reason, you might want to keep deleted emails for a little bit longer, and this guide will aid in achieving that task. We will cover the following:

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

1] Select the correct permissions

First thing is first, and that is to assign the permissions that makes sense for this specific issue. To do this, you must visit and check the section, Recipient provisioning permissions, and assign the one listed below on your Exchange Online server.

READ  How to open Folder or File Explorer Options in Windows 10

2] Connect Windows PowerShell to Exchange Online

keep deleted emails for longer in Outlook

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

$UserCredential = Get-Credential

When the dialog box comes up, please type in your school, or work account, then your password, and click OK. The next step, then, is to copy and paste another command, and it goes like this, here:

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

Also, run this command after performing the previous:

Import-PSSession $Session -DisableNameChecking

3] Disconnect the remote PowerShell session

After all of that is done, we suggest not closing Windows PowerShell outright, but instead disconnect it. You see, if you close the window, you could use up all the remote PowerShell sessions available to you, and you’ll need to wait for the sessions to expire.

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

Remove-PSSession $Session

4] Change how long permanently deleted items are kept

Now its time to do what you came here to do in the first place, so please fire up Windows PowerShell again, and type the following command into the box and hit Enter:

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

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

READ  TinyWall lets you harden and control Windows 10 Firewall

As for making 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 are done. If you need more information visit

Click to comment

Leave a Reply

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

You May Also Like


Football is considered a king sport in all sports. The football matches bring viewers a lot of emotions, from bursting with emotion to regret....


Write For Us Now we are accepting guest post into our website and start writing. Please email your articles at [email protected] [email protected]   Welcome...


Stellar Converter for MBOX is designed to facilitate the change from MBOX format to MS Outlook PST documents. It is a flexible tool, as...


Extratorrent, the most popular torrent site due to its huge database of torrent content. You can find and download here every type of torrent...