Export-MapiMSG

Description

Exports an item as an MSG file.

Syntax

Note: Parameters in orange are optional.

Export-MapiMSG
-MapiItemMapiObject<Mapi.NET.Message>
-FileNameString
-OverwriteExistingString

Parameters

MapiItemA Mapi.NET.Message object that is the item to be exported.  Use Get-MapiItem to get an instance of this object type
FileNameA string value that is the full path and filename of the new MSG file to be exported.
OverwriteExistingA optional SwitchParameter, which when present will cause an existing file with the same name to be overwritten

Remarks

This cmdlet exports and item to a msg file.

Note that the FileName parameter does not require that the file name end with the *.MSG extension; any extension text is allowed.  However, Outlook on installation automatically associates the *.MSG extension with itself for convenience.

 

The MSG file type is a common file type used by Outlook.  The MSG file type is a Microsoft OLE Compound Document, also known as StructuredStorage.  MSG files have some limitations that can cause them to corrupt, namely large recipient lists.

Although the MSG file type is conveniently opened in Outlook, it is not a suitable archival type.  Due to the nature of how MSG files are created by MAPI, some attributes are ignore and others are modified upon save, for example the PR_LAST_MODIFICATION_TIME property of the item in the MSG file will be the date/time the MSG file was created.  The modified time stored in the original item is not preserved.

PowerMAPI suggests, for purposes of archival or transport, to use either the XML or PackedBinary formats.  PowerMAPI can export and import PackedBinary files, but (currently) is only able to export XML.