Class MapiConversionOptions

MapiConversionOptions class

Options that control how a MailMessage is converted to a MapiMessage.

public class MapiConversionOptions

Constructors

NameDescription
MapiConversionOptions()Initializes a new instance of the MapiConversionOptions class that produces an ANSI message.
MapiConversionOptions(OutlookMessageFormat)Initializes a new instance of the MapiConversionOptions class that produces a message in the specified format.

Properties

NameDescription
static ASCIIFormat { get; }Gets new options that produce a message in ANSI (8-bit) format.
static UnicodeFormat { get; }Gets new options that produce a message in Unicode format.
CustomProgressHandler { get; set; }Gets or sets a handler that is called as the conversion progresses.
ForcedRtfBodyForAppointment { get; set; }Gets or sets a value indicating whether an appointment or a meeting request gets an RTF body built from the body of the source message. The default is false.
Format { get; set; }Gets or sets the format of the resulting message: Unicode or ANSI. The default is ANSI.
PreserveEmbeddedMessageFormat { get; set; }Gets or sets a value indicating whether embedded messages stay in EML format instead of being converted to MSG. The default is false.
PreserveEmptyDates { get; set; }Gets or sets a value indicating whether the creation and modification dates are left unset. When false (the default), both are set to the time of the conversion.
PreserveOriginalAddresses { get; set; }Gets or sets a value indicating whether the addresses are kept exactly as in the source message, without validation. The default is false.
PreserveOriginalDates { get; set; }Gets or sets a value indicating whether the sent date of the source message is kept. When false, the time of the conversion is used. The default is true.
RemoveSignature { get; set; }Gets or sets a value indicating whether the digital signature is removed from a signed message during the conversion.
UseBodyCompression { get; set; }Gets or sets a value indicating whether the RTF body is stored compressed. The default is false.

Remarks

Pass an instance to FromMailMessage. UnicodeFormat and ASCIIFormat return ready-made options for the two MSG formats.

Examples

This example converts an EML file to a Unicode MSG file, keeping the original dates.

[C#]

var eml = MailMessage.Load("message.eml");

var options = MapiConversionOptions.UnicodeFormat;
options.PreserveOriginalDates = true;

using (MapiMessage msg = MapiMessage.FromMailMessage(eml, options))
{
    msg.Save("message.msg");
}

[Visual Basic]

Dim eml = MailMessage.Load("message.eml")

Dim options = MapiConversionOptions.UnicodeFormat
options.PreserveOriginalDates = True

Using msg As MapiMessage = MapiMessage.FromMailMessage(eml, options)
    msg.Save("message.msg")
End Using

See Also