Class MsgSaveOptions

MsgSaveOptions class

This class allows the user to specify additional settings when saving a MailMessage in the Msg(ASCII) and Msg(Unicode) format.

public class MsgSaveOptions : SaveOptions

Constructors

NameDescription
MsgSaveOptions(MailMessageSaveType)Initializes a new instance of this class that can be used to save a MailMessage in the Msg(ASCII) and Msg(Unicode) format.

Properties

NameDescription
CustomProgressHandler { get; set; }Represents method that usually supplied by calling side and handles progress events.
MailMessageSaveType { get; set; }Represents the mail message save type.It can be in eml,msg(ASCII or Unicode),mhtml or html format. The default value is Eml.
PreserveOriginalDates { get; set; }Gets or sets a value indicating whether it is necessary to generate new saving and modification dates when saving a message. By default the value is true, meaning the creation and modification dates will be not set to DateTime.Now.

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