Save-MapiAttach

Description

This cmdlet saves an attachment to a file.

Syntax
Note: Parameters in orange are optional.
Save-MapiAttach
-MessageMapiObject<Mapi.NET.Message>
-AttachmentNumberSystem.Int32
-SaveToPathString
-FilenameString
-OverwriteExistingSwitchParameter
Save-MapiAttach
-AttachMapiObject<Mapi.NET.Attachment>
-SaveToPathString
-FilenameString
-OverwriteExistingSwitchParameter
Parameters
MessageA Mapi.NET.Message from which an attachment is saved.
AttachmentNumberA System.Int32 value which identifies the specific attachment in the attachment table of the message.
AttachA Mapi.NET.Attachment object from which to save to a file.
SaveToPathA text string that represents the file system folder into which to create and save the attachment.
FileNameAn optional text string that is used for the file name. If omitted, attachment metadata is used.
OverwriteExistingA SwitchParameter which, if present, allows for overwriting an existing file with the same name.
Remarks

This cmdlet saves attachment data as a file in a file system.

Attachments on messages are identified by an index number.  Use Get-MapiAttach to get the attachment number of an attachment.

Attachments can be "hidden" from standard mail clients.  For example, inline graphics of an HTML message body are stored as attachments, but have flags to prevent them from appearing as "attachments" when rendered in a client application.  This cmdlet can save any attachment, hidden or visible, however non-visible attachements sometimes do not have filename metadata and may require the use of the Filename parameter.

Attachments can also be stored in a Structured Storage format (also known as MSG files).  This is most commonly found when a user attaches another email message to a message.  This cmdlet will save such attachments as MSG files.

Note that accessing and saving attachments from messages in an Exchange mailbox may incur network activity.  Large attachments may take some time to save since MAPI will have to wait on network operations for streaming the data locally.