Microsoft 365: Error messages during achiving
Posted by Rebecca Rommelrath on 2 Jul 2021 10:12

During Archiving from Microsoft 365 mailboxes,
one of the following errors occurs:

"EWS Error Code: ErrorInvalidExchangeImpersonationHeaderData"

Connect via Exchange Online Powershell to Microsoft 365 and move the mailbox to annother database.
(This might take some time)

New-MoveRequest -Identity "Mailboxname"

Look at status move-request:
Get-Moverequest -Identity "Mailboxname"

Background information:
The impersonation mailbox information has become corrupt and moving it to a different database triggers a correction

Error: "EWS Error Code: ErrorItemNotFound"


Find out which users are attached to which databases.

Check mailbox locations in Exchange Online Powershell:  
$cred=Get-credential  Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force  $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $cred -Authentication Basic –AllowRedirection  Import-PSSession $Session  

The Get-Mailbox command with no other parameters will return a list of all mailboxes and include the Database field with that.

The service principal must be located in the same localisation as the mailboxes it is trying to reference.

A forced mailbox move can be done via Powershell:

The move request will automatically pick a database based on Microsoft 365 preferences.
In our case this meant relocating to a correct database.
Background information:
Something went wrong with an initial migration leaving incomplete or incorrect records for some mailboxes.

Error: " The remote server returned an error: (401) Unauthorized"


Check the required API permissions:

Background information:
The permission "Office 365 Exchange Online.full_access_as_app" must be present, of type "Application" and granted by the Administrator

Error: "Requesting the OAuth2 token to access the mailbox has failed. Error: Keyset does not exist"

You need to use a MailStore system which fulfills the system requirements, especially the CPU cores/threads.
The minimum is 4 cores, 4 threads for Journal archiving, 4 cores, 8 threads for user mailbox archiving.

Article-ID: KB20210702-0-EN (Deutsche Version)

(4 vote(s))
Not helpful

Remote Support

Please download our TeamViewer client in order to allow the MailStore support team a one-time only access to your system.

Premium Support

If your MailStore Server license includes Premium Support or you are using the MailStore Service Provider Edition, you are entitled to get in touch with our support team directly via phone.


+49 2162 50299-12


+1 800 747 2915