SOLVED

Can't empty deleted items folder - Outlook 2016 / Exchange Online Plan 1

Brass Contributor

Hi

 

Have a problems with Office 365 / Outlook 2016 / Exchange Online Plan 1

 

I have a service mailbox which has 60000 emails in deleted items folder and I can't empty it - tried in Outlook and via OWA - they appear to go but if I refresh they come back

 

Also tried mfcmapi deleting "recoverable items" and "deleted items" as per http://m1econsulting.com/knowledge-base/clear-out-deleted-items-folder-with-mfcmapi-exchange-2010/ which doesn't work

 

Also tried deleting the whole Deleted Items folder as per mention here - https://social.technet.microsoft.com/Forums/ie/en-US/e65534c4-3b35-48ea-b54a-3412af600be3/cant-delet...

 

But that fails with error below:-

 

Warning:
Code: MAPI_W_PARTIAL_COMPLETION == 0x00040680
Function lpParentFolder->DeleteFolder( lpItemEID->cb, reinterpret_cast<LPENTRYID>(lpItemEID->lpb), lpProgress ? reinterpret_cast<ULONG_PTR>(m_hWnd) : NULL, lpProgress, ulFlags)
File c:\projects\mfcmapi\ui\dialogs\hierarchytable\msgstoredlg.cpp
Line 788

 

Mailbox is now just under its 50gb limit and problem is getting urgent as this mailbox processes emails automatically so needs to be working

 

 

Any ideas please?

19 Replies
Hi Darren,

Have you tried this via Powershell?

https://social.technet.microsoft.com/Forums/en-US/4467926b-af01-415d-85ac-72954521d4e8/user-cant-emp...

This organisation was having a similar issue of mail in the deleted items folder reappearing.

Let me know if this works. If not, we'll think of other ways.

Best, Chris
best response confirmed by Darren Rose (Brass Contributor)
Solution

Hi Chris

 

Thanks for your reply and the suggested article which has certainly given me some useful notes for next time I have a problem

 

In the end as the mailbox is critical to our business (process incoming mail for a document management system), I logged a support call with Microsoft and a really helpful chap advised it was due to the 14 day retention policy on mailbox not working and used some powershell commands to get it working

 

So fingers crossed the 60000+ items in deleted items has now started to go down and 99% of my 50Gb used is now 85% so much improved

 

Thank you for your reply

Thanks Darren, thanks for confirming. Really glad it's working. In that case, if you could mark it as the solution and then drop us a line if the issue is unresolved, or you have an issue elsewhere and we'll look straight into it. Had a great rest of the weekend.

 

Oh, in order to prevent it happening again, you can always turn the archive on the mailbox which is another 50Gb and put a retention policy that everything older than, say, a year, will go into the archive or delete. It may be a way of keeping the mailbox clear for the future.

Best, Chris

Will do - thanks again Chris

Why wasn't the retention policy working? Perhaps it was simply that the Managed Folder Assistant had skipped the mailbox for some reason (it uses a weekly workcycle) and the command used to get things going again was Start-ManagedFolderAssistant? 

Unfortunately I don't know why it had stopped working, just know it must have done as inbox had four weeks of mail rather than the two weeks (14 days) it was supposed to contain and that was why it was hitting limit.  Problem then got worse when I tried deleting loads of them manually, it wouldn't let me delete permanently so had to delete and put in deleted items, then I couldn't empty deleted items, so ended up over size limit and with bin not working/emptying

 

Using Start-ManageFolderAssistant then kicked it in to life (after purging RecoverableItems as well) and deleted folder went from 60000+ items (9gb+) to 0 items in about 6 hours

so does that mean a retention rule (the Managed Folder Assistant) only runs once a week normally? so even if doing 14 day retention, it may get to 20/21 days if only running once every 7 days normally?

The aim of the workcycle used by the MFA is to process mailboxes at least once at week. Often it happens more often. The exact details depend on server load. If you have a policy to remove items from the Deleted Items folder once they are 14 days old, they should be removed on that basis.

thanks for reply

 

Yes we have a 14 day deletions policy to delete all mail in inbox permanently if over 14 days old, so like this should avoid it going in deleted items.

 

Will keep monitoring mailbox now to make sure it works and doesn't creep up to 50gb again

I wrote some code to figure out how often MFA processes mailboxes on my tenant. It seems like they are being processed at least a couple of times per week. Try this on your tenant: https://office365itpros.com/2018/12/10/reporting-the-managed-folder-assistant/

Thank you very much - I will give that a try

I'm having the exact same problem with an Exchange Online mailbox. Using PowerShell I was able to locate about 166000 emails from Dec 2017 to April 2019 worth 100GB which are stuck in the Purges folder but no matter what I do I'm unable to delete them.

The PowerShell commands MS Support gave me didn't work and with MFCMAPI I'm also not able to delete them.

Any advise would be greatly appreciated...

@AndreKotze 

 

I am experiencing also... no Powershell scripts are working. When we delete items, they show back up in seconds. Issue is our 100GB mailbox limit keeps getting maxed out and I cant delete anything to make space. No litigation holds. 

 

Things tried:

  1. Search-Mailbox "mymailbox@contoso.com" -SearchQuery ‘(received=2018-01-01..2019-11-01)(sent=2018-01-01..2019-11-01)’ -DeleteContent -Force
  2. Start-ManagedFolderAssistant "mymailbox@contoso.com"
  3. Delete via OWA - items delete "temporarily" then reappear. 
  4. Tried using MFCMapi to delete the contents of the Deleted Items and Recovery Items
  5. New Exchange MRM Policy (delete anything 7 days or older)
  6. Enable a ExOL Archive mailbox, create a new Exchange MRM Policy to move anything older than 7 days to archive. 
  7. Delete from the Outlook client obviously... cached and uncached mode. 

 

Results: 

Get-MailboxFolderStatistics "mymailbox@contoso.com" -FolderScope "RecoverableItems" | Format-List Name,FolderAndSubfolderSize

 

Name : Recoverable Items
FolderAndSubfolderSize : 110 GB (118,111,612,814 bytes)

Name : DiscoveryHolds
FolderAndSubfolderSize : 92.84 GB (99,683,338,775 bytes)

 

Get-MailboxFolderStatistics "mymailbox@contoso.com" -FolderScope "DeletedItems" | Format-List Name,FolderAndSubfolderSize

 

Name : Deleted Items
FolderAndSubfolderSize : 79.86 GB (85,753,721,801 bytes)

 

 

None of the above worked. 

So this is very frustrating to say the least. MS ticket open but no fix at this time. 

 

@Darren Rose 

Mark all the emails and then click Empty Folder.

For me it turns out a previous admin had enabled the "Preservation Lock" option which means that anything not older than 5 years cannot be purged from the Recoverable Items folder.

@Darren Rose Years later, 4 separate support tickets, multiple "I understand the frustration you are feeling" phone calls with support, and this is still an issue. Nothing works. I am, to be honest, dumbfounded by the simplicity of this request and the inability of the Great Monopoly Microsoft to comply with a simple "select," and "delete" command that would enable the removal of the trash and recoverable data.

@jimbarrgpboston I completely agree, had the issue again recently and still such a pain, as you say it is not exactly a difficult request is it..

@Darren Rose and others, let me be of some assistance here. After a 10 day odyssey with Microsoft support there are specific reasons why deletion is not possible, especially as the mailbox gets to 100% full. It involves multiple steps to solve and will take some machine time to complete, but I will provide some Powershell steps to assist you. PLEASE NOTE, you will be permanently deleting items in the Deleted Items box in this process and they will NOT be recoverable! You can change things back to defaults after completion.

 

First, create a deleted items policy for the mailbox in question by going to EAC, Compliance Management, Retention Tags. Hit the + sign and "apply automatically to a default folder." Choose Deleted Items as the default folder, then click Permanently Delete, Retention Period should be Never.

 

Now, go to Retention Policies, and create a new policy, name it, and go to + sign for Retention Tags and add the one tag you just created and save the policy.

 

Next, go to the mailbox in question, click on Mailbox Features, and add change the Retention Policy to the new one you just created and save.

 

Now, open up Powershell and connect to Exchange Online (I use connect-ExchangeOnline command with modern authentication, as I've added these cmdlets to my Powershell environment, but you can still use the downloadable Exchange Powershell and connect-EXOPSession command if you like, they are both the same thing).

 

Force update to the retention policy by typing:

Start-ManagedFolderAssistant -Identity <email-address-of-affected-mailbox>

 

You may have to wait up to 24 hours, but things should delete that can be deleted, but you're not done yet.

 

Open EAC, and go to Permissions and add your account you log into Powershell with to the Discovery Management object under Admin Roles. You will have to wait about 10 minutes for this to take effect.

 

Open Powershell and connect to Exchange Online again, and send this command:

Get-ManagementRole -Cmdlet Search-Mailbox

This will add the "search-Mailbox" command and associated cmdlets to your shell for the next command to work:

search-mailbox -identity <email-address-of-affected-mailbox> -searchdumpsteronly -deletecontent

The above command will take sometimes hours to complete, and mail fail with a Store connect failure, but simply re-run it until it returns a cursor.

 

After that, you should be able to go to the Deleted Items folder on the affected mailbox using OWA and delete all mail. Don't forget to purge all deleted items after you so this so they are non-recoverable (this cannot be undone!). After all this, the "dumpster" command above can be re-run to make sure any add'l email is removed.

 

You may then check the dumpster size with this command:

Get-MailboxFolderStatistics -Identity <email-address-of-affected-mailbox> -Folderscope RecoverableItems | select name,foldersize,ItemsInFolder

 

When done, it is advisable you REMOVE yourself as a member from the Discovery Management object in EAC/Permissions/Admin Roles so you do not accidentally delete permanent objects.

 

Hope this helps. It was painful, but that got a mailbox from 100+% down below 10%.

 

JB

@jimbarrgpboston - Excellent explanation - bookmarked for future reference - thanks

1 best response

Accepted Solutions
best response confirmed by Darren Rose (Brass Contributor)
Solution

Hi Chris

 

Thanks for your reply and the suggested article which has certainly given me some useful notes for next time I have a problem

 

In the end as the mailbox is critical to our business (process incoming mail for a document management system), I logged a support call with Microsoft and a really helpful chap advised it was due to the 14 day retention policy on mailbox not working and used some powershell commands to get it working

 

So fingers crossed the 60000+ items in deleted items has now started to go down and 99% of my 50Gb used is now 85% so much improved

 

Thank you for your reply

View solution in original post