Previously you could delete all emails using Search-Mailbox PowerShell but this command no longer works. Microsoft decided to replace it with ComplianceSearch PowerShell but you can only delete 10 emails at a time with this. In order to delete emails now, you need to use Retention policies. You can learn more about it below:
1. Logon to https://protection.office.com/retention as an administrator who has Organization Management or Compliance Administrator roles assigned
2. Click create
3. Give the policy a name and description and click next
4. Select "No, just delete content that's older than", select 1 days, and Delete the content based on "When it was created". Click next
5. Select "Exchange email" and unselect everything else if you are only deleting email and no other content needs to be deleted. Select "Choose recipients"
6. Click "Choose recipients" again
7. Search or pick a user from the list and click choose
7. Click Done and click Next
8. Review everything and click "Create this policy"
Note: It will take up to 1 day to apply the retention policy to the locations you chose.
If you do not wish to wait for the policy to take effect please follow the steps mentioned below:
1. Open PowerShell and Install ExchnageOnline PowerShell Module by running the following commands:
Set-ExecutionPolicy RemoteSigned
Install-Module -Name ExchangeOnlineManagement
Note: Skip this step if you already have exchange online PowerShell installed
1. Open PowerShell and run the following command to connect to exchange online:
Connect-ExchangeOnline
2. Run the below-mentioned command to force a retention policy to run right away
Start-ManagedFolderAssistant -Identity emailaddress
Note: Replace "emailaddress" with the email of the user in question
Comments
0 comments
Please sign in to leave a comment.