Recently I came across one of the weirdest mailbox corruptions I’ve ever seen.
Initially the problem arose as the customer’s inability to login to Outlook Web Access and later on expanded to problems using Outlook mail client while deleting the content.
OWA login page was producing nice call stack errors like these -
Exception
Exception type: Microsoft.Exchange.Data.Storage.StorageTransientException
Exception message: Cannot set search criteria in SearchFolder.
Call stack
Microsoft.Exchange.Data.Storage.CoreFolder.SetSearchCriteria(SearchFolderCriteria searchFolderCriteria, SetSearchCriteriaFlags setSearchCriteriaFlags)
Microsoft.Exchange.Data.Storage.SearchFolder.ApplyContinuousSearch(SearchFolderCriteria searchFolderCriteria)
Microsoft.Exchange.Data.Storage.RemindersSearchFolderValidation.VerifyAndFixRemindersSearchFolder(DefaultFolderContext context, SearchFolder reminders)
Microsoft.Exchange.Data.Storage.DefaultFolderValidator.Validate(DefaultFolderContext context, StoreObjectId folderId, Dictionary`2 folderDataDictionary)
And like this -
Inner Exception
Exception type: Microsoft.Mapi.MapiExceptionNotEnoughMemory
Exception message: MapiExceptionNotEnoughMemory: Unable to SetSearchCriteria. (hr=0x8007000e, ec=1008) Diagnostic context: Lid: 18969 EcDoRpcExt2 called [length=293] Lid: 27161 EcDoRpcExt2 returned [ec=0x0][length=572][latency=15] Lid: 23226 — ROP Parse Start — Lid: 27962 ROP: ropSetSearchCriteria [48] Lid: 17082 ROP Error: 0x3F0 Lid: 27745 Lid: 21921 StoreEc: 0x3F0 Lid: 27962 ROP:
Having setup Outlook profile I was able to login to mailbox and here’s the weirdo I met -

This marvelous pattern might have apparently been found everywhere (e.g in Deleted items, not only in Inbox as here). This is iteration that cannot be handled by Exchange. Moreover, this pattern cannot be deleted at all!
Neither by Outlook/OWA means nor MFCMapi. The latter throws exception too.
Here’s the solution:
Export mailbox content skipping the folder containing this weirdo.
Mighty PowerShell does it as easy as possible, see generic example below:
Re-create a mailbox, import the data.
That’s it.
