|Message||A Mapi.NET.Message from which to delete the specific attachment.|
|AttachNum||A System.Int32 value that is the current identifier of the attachment.|
|Attachment||A Mapi.NET.Attachment object to be deleted from its underlying message.|
This cmdlet removes a single attachment from a MAPI message.
Attachments on messages are stored in a separate "attachment table" in the message. Operations on attachments are done by their corresponding "attachment number", which is a sequential numbering from zero to the total number of attachments minus one.
When removing attachments, a subsequent re-listing of the attachments will cause the attachment numbers to be recalculated. As such, when removing multiple attachments from a message, remove attachments in descending order of the attachment numbers so that a re-listing of the attachments is unnecessary.
Attachments on messages can be hidden in standard mail clients but will still be part of the attachment list. For example, inline graphics of an HTML message body are stored as attachments, but are not shown as "attachments" to a user. Be sure to check the metadata of an attachment before removal to ensure that the attachment matches the one desired for removal. Deleted attachments are non-recoverable.