0

Please advise of there is a way to empty the deleted items folder of an office365 mailbox. This is not an on-premise exchange, all hosted in microsoft.

I have tried this command:

Search-mailbox -identity <username> -TargetMailbox "inbox" -Targetfolder "Deleted Items" -DeleteContent -Verbose

It does not work. It executes but does not have any effect on the deleted items folder.

Thanks in advance.

Chyornaya Vdova
  • 94
  • 2
  • 2
  • 7

2 Answers2

2

You will have to change the default email retention for deleted items in Office 365. Not a long time ago, it was 30 days by default, but Microsoft decided to change it to something like "Keep Forever".

Create a custom 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 Office 365 navigate to Office 365 Admin > Exchange admin center > compliance management > retention policies. Next, select Default MRM Policy, click the edit icon and then change the name of the policy.

https://blogs.office.com/2015/02/20/extended-email-retention-deleted-items-office-365/

Noor Khaldi
  • 3,829
  • 3
  • 18
  • 28
1

The way you have structured your command is incorrect. TargetMailbox and TargetFolder specify the destination where search results are copied. This is typically a Discovery Mailbox or similar.

What you have specified will look in the mailbox <username> copy all content (no query or other criteria is specified) to a mailbox called Inbox, in a folder called Deleted Items. Everything in the mailbox <username> should have been deleted from the source mailbox and copied to the Inbox mailbox (should it exist, I think this would have thrown an error).

Please review TechNet for Search-Mailbox: https://technet.microsoft.com/en-us/library/dd298173%28v=exchg.160%29.aspx

You will want something like the following:

Search-Mailbox -Identity source.mailbox@domain.com -SearchDumpsterOnly -DeleteContent

Now, I should clarify: This would permanently delete the contents of the Recoverable Items folder, a hidden system folder where things go AFTER they disappear from Deleted Items. If Legal Holds are employed, all bets are off and it is entirely possible/likely content could still be discovered, depending on the holds employed.

blaughw
  • 2,242
  • 1
  • 10
  • 17