Recently I came across an error message during mailbox move from Exchange 2010 to Exchange 2016 (this error can also happen in other migration scenarios, for example hybrid migrations to Exchange Online). The move already stopped while creating folder hierarchy.

Error details

Job Report shows:

Request processing continued, stage CreatingFolderHierarchy.
Stage: CreatingFolderHierarchy. Percent complete: 10.
Transient error StoragePermanentException has occurred. The system will retry

Error details:

Failure Type: StoragePermanentException
WorkItem: CreateFolderHierarchy

Message: 

Cannot query rows in a table. –> MapiExceptionTooComplex: Unable to query table rows.
(hr=0x80040117, ec=-2147221225)

DataContext:

Operation: StorageDestinationFolder.ApplyRestriction
Restriction: Restriction: LCID=0x807, AND…

So basically in that case there was something wrong with folder restrictions.

Get detailed error report for mailbox move request

Get-MoveRequestStatistics alias -IncludeReport | Export-Clixml C:\temp\movereport.xml
$stats = Import-CliXml C:\temp\movereport.xml
$stats.report.failures[-1] | Out-File C:\temp\moveerror.txt

In the Text file you now see only the error messages and DataContext clarifies what’s going wrong here.

In the case above we see there is something wrong with the folder restrictions.

Solution

As soon we get the detailed error, the solution is simple: Just skip moving folder restrictions.

New-MoveRequest -Identity alias -TargetDatabase DB01 -SkipMoving FolderRestrictions

You probably see different errors and depending on what your error message is you need to use KnownCorruptions, FolderViews or eventually need to access the mailbox with MFCMAPI to correct an error or deleting a folder which was mentioned in the error message. But before deleting folders, please take a backup.