Class MsgSaveOptions

MsgSaveOptions class

Options for saving a MailMessage to Outlook MSG format, with ANSI or Unicode strings, or to an Outlook template (OFT).

public class MsgSaveOptions : SaveOptions

Constructors

NameDescription
MsgSaveOptions(MailMessageSaveType)Initializes a new instance of the MsgSaveOptions class for the specified format.

Properties

NameDescription
CustomProgressHandler { get; set; }Gets or sets a handler that is called as the saving progresses.
MailMessageSaveType { get; set; }Gets or sets the format the options save to.
PreserveOriginalDates { get; set; }Gets or sets a value indicating whether the dates of the message are kept. When false, the creation and modification dates are set to the time of saving. The default is true.

Remarks

Get ready-made options from DefaultMsgUnicode, DefaultMsg or DefaultOft.

Examples

The following example shows how to save as MSG with preserved dates.

[C#]

// Initialize and Load an existing EML file by specifying the MessageFormat
var eml = MailMessage.Load("Message.eml");

// Save as msg with preserved dates
var msgSaveOptions = new MsgSaveOptions(MailMessageSaveType.OutlookMessageFormatUnicode)
{
    PreserveOriginalDates = true
};

eml.Save("outTest_out.msg", msgSaveOptions);

[Visual Basic]

' Initialize and Load an existing EML file by specifying the MessageFormat
Dim eml = MailMessage.Load("Message.eml")

' Save as msg with preserved dates
    Dim msgSaveOptions = New MsgSaveOptions(MailMessageSaveType.OutlookMessageFormatUnicode) With {
        .PreserveOriginalDates = True
    }

eml.Save("outTest_out.msg", msgSaveOptions)

See Also