Applies to: Exchange Online, Exchange Online Protection

Topic Last Modified: 2018-01-11

This cmdlet is available only in the cloud-based service.

Use the Export-QuarantineMessage cmdlet to export quarantined messages from your cloud-based organization to .eml message files. You can then open the .eml files in Outlook.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Export-QuarantineMessage -Identity <QuarantineMessageIdentity>

This example exports the quarantined message with the specified Identity value.

Step 1: Run the following commands to determine the message encoding (the value of the BodyEncoding property in the output; for example, ascii):

$e=Export-QuarantineMessage -Identity c14401cf-aa9a-465b-cfd5-08d0f0ca37c5\4c2ca98e-94ea-db3a-7eb8-3b63657d4db7

Step 2: Run the following command to export the message to the specified file using the message encoding that you found in the previous step:

$e  | select -ExpandProperty Eml | Out-File "C:\My Documents\Export1_ascii.eml" -Encoding ascii


  • The "| select -ExpandProperty Eml" part of the command specifies the whole message, including attachments.

  • You need to use the Out-File cmdlet to write the .eml message file with the required encoding. If you use the default PowerShell redirection operator ">" to write the output file, the default encoding is Unicode, which might not match the actual message encoding.

You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see Find the permissions required to run any Exchange cmdlet.


Parameter Required Type Description




The Identity parameter specifies the quarantined message that you want to export. The value is a unique quarantined message identifier in the format GUID1\GUID2 (for example c14401cf-aa9a-465b-cfd5-08d0f0ca37c5\4c2ca98e-94ea-db3a-7eb8-3b63657d4db7.

You can find the Identity value for a quarantined message by using the Get-QuarantineMessage cmdlet.

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn’t accept input data.

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn’t return data.