MapiMessage.LoadAsync

LoadAsync(string, CancellationToken)

Loads a MapiMessage from the specified file asynchronously.

public static Task<MapiMessage> LoadAsync(string fileName, CancellationToken token = default)
ParameterTypeDescription
fileNameStringThe name of the file to load the message from.
tokenCancellationTokenPropagates notification that operations should be canceled.

Return Value

Returns a MapiMessage instance loaded from the specified file.

Exceptions

exceptioncondition
ArgumentExceptionfileName is null or empty.
FileNotFoundExceptionThe specified file does not exist.

See Also


LoadAsync(Stream, CancellationToken)

Loads a MapiMessage from the specified stream asynchronously.

public static Task<MapiMessage> LoadAsync(Stream stream, CancellationToken token = default)
ParameterTypeDescription
streamStreamThe stream to load the message from.
tokenCancellationTokenPropagates notification that operations should be canceled.

Return Value

Returns a MapiMessage instance loaded from the specified stream.

Exceptions

exceptioncondition
ArgumentNullExceptionstream is null.
NotSupportedExceptionstream does not support reading.

See Also


LoadAsync(string, LoadOptions, CancellationToken)

Loads a MapiMessage from the specified file with specified options asynchronously.

public static Task<MapiMessage> LoadAsync(string fileName, LoadOptions options, 
    CancellationToken token = default)
ParameterTypeDescription
fileNameStringThe name of the file to load the message from.
optionsLoadOptionsOptions for loading message. If null, the format is detected from the data: an MSG is loaded with MsgLoadOptions, anything else with EmlLoadOptions.
tokenCancellationTokenPropagates notification that operations should be canceled.

Return Value

Returns a MapiMessage instance loaded from the specified file.

Exceptions

exceptioncondition
ArgumentExceptionfileName is null or empty.
FileNotFoundExceptionThe specified file does not exist.

See Also


LoadAsync(Stream, LoadOptions, CancellationToken)

Loads a MapiMessage from the specified stream with specified options asynchronously.

public static Task<MapiMessage> LoadAsync(Stream stream, LoadOptions options, 
    CancellationToken token = default)
ParameterTypeDescription
streamStreamThe stream to load the message from.
optionsLoadOptionsOptions for loading message. If null, the format is detected from the data: an MSG is loaded with MsgLoadOptions, anything else with EmlLoadOptions.
tokenCancellationTokenPropagates notification that operations should be canceled.

Return Value

Returns a MapiMessage instance loaded from the specified stream.

Exceptions

exceptioncondition
ArgumentNullExceptionstream is null.
NotSupportedExceptionstream does not support reading.

See Also