TnefConversionResult Class

The result of converting a TNEF message to MIME.

Definition

Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public sealed class TnefConversionResult : IDisposable
Inheritance
Object    TnefConversionResult
Implements
IDisposable

Remarks

The result of converting a TnefMessage to MIME using ConvertToMime(TnefConversionOptions, CancellationToken).

Example

C#
                    public static MimeMessage ConvertToMime (TnefPart part)
{
    // Load the content of the application/ms-tnef (winmail.dat) part.
    using (var tnef = part.LoadTnefMessage ()) {
        // By default, embedded messages are converted into nested TnefParts. Set ConvertEmbeddedMessages
        // to convert them into message/rfc822 MessageParts instead.
        var options = new TnefConversionOptions { ConvertEmbeddedMessages = true };

        // Convert the TNEF message into a MimeMessage. The converted message does not depend on the
        // TnefMessage, so it may still be used after the TnefMessage has been disposed.
        var result = tnef.ConvertToMime (options);

        // Anything that could not be represented in MIME is reported as a conversion loss.
        foreach (var loss in result.Losses)
            Console.WriteLine ("TNEF conversion loss: {0}: {1}", loss.Kind, loss.Description);

        // Note: Disposing the result would also dispose result.Message, so don't dispose it
        // if you want to keep using the message.
        return result.Message;
    }
}
                  

Properties

Losses Get the information that was lost during the conversion.
Message Get the converted message.

Methods

Dispose Release all resources used by the TnefConversionResult object.
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetType Gets the Type of the current instance.
(Inherited from Object)
ToString Returns a string that represents the current object.
(Inherited from Object)

See Also