Tnef Part Class
A MIME part containing Microsoft TNEF data.
Definition
Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public class TnefPart : MimePart, ITnefPart,
IMimePart, IMimeEntity, IDisposable- Inheritance
- Object MimeEntity MimePart TnefPart
- Implements
- IMimeEntity, IMimePart, ITnefPart, IDisposable
Remarks
Represents an application/ms-tnef or application/vnd.ms-tnef part.
TNEF (Transport Neutral Encapsulation Format) attachments are most often sent by Microsoft Outlook clients.
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;
}
}
Constructors
| TnefPart | Initialize a new instance of the TnefPart class. |
| TnefPart(MimeEntityConstructorArgs) | Initialize a new instance of the TnefPart class. |
Properties
| Content |
Get or set the MIME content.
(Inherited from MimePart) |
| ContentBase |
Get or set the base content URI.
(Inherited from MimeEntity) |
| ContentDescription |
Get or set the description of the content if available.
(Inherited from MimePart) |
| ContentDisposition |
Get or set the content disposition.
(Inherited from MimeEntity) |
| ContentDuration |
Get or set the duration of the content if available.
(Inherited from MimePart) |
| ContentId |
Get or set the Content-Id.
(Inherited from MimeEntity) |
| ContentLocation |
Get or set the content location.
(Inherited from MimeEntity) |
| ContentMd5 |
Get or set the md5sum of the content.
(Inherited from MimePart) |
| ContentTransferEncoding |
Get or set the content transfer encoding.
(Inherited from MimePart) |
| ContentType |
Get the type of the content.
(Inherited from MimeEntity) |
| FileName |
Get or set the name of the file.
(Inherited from MimePart) |
| Headers |
Get the list of headers.
(Inherited from MimeEntity) |
| IsAttachment |
Get a value indicating whether this MimePart is an attachment.
(Inherited from MimeEntity) |
Methods
| Accept |
Dispatches to the specific visit method for this MIME entity.
(Overrides MimePartAccept(MimeVisitor)) |
| ComputeContentMd5 |
Compute the MD5 checksum of the content.
(Inherited from MimePart) |
| Dispose |
Releases all resources used by the MimeEntity object.
(Inherited from MimeEntity) |
| Dispose(Boolean) |
Releases the unmanaged resources used by the MimePart and
optionally releases the managed resources.
(Inherited from MimePart) |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
| GetBestEncoding(EncodingConstraint, CancellationToken) |
Calculate the most efficient content encoding given the specified constraint.
(Inherited from MimePart) |
| GetBestEncoding(EncodingConstraint, Int32, CancellationToken) |
Calculate the most efficient content encoding given the specified constraint.
(Inherited from MimePart) |
| GetHashCode | Serves as the default hash function. (Inherited from Object) |
| GetType | Gets the Type of the current instance. (Inherited from Object) |
| LoadTnefMessage | Load the TNEF message contained within the part. |
| LoadTnefMessageAsync | Asynchronously load the TNEF message contained within the part. |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) |
| OnHeadersChanged |
Called when the headers change in some way.
(Inherited from MimePart) |
| Prepare |
Prepare the MIME entity for transport using the specified encoding constraints.
(Inherited from MimePart) |
| RemoveHeader |
Remove a header by name.
(Inherited from MimeEntity) |
| SetHeader(String, Byte) |
Set the value of a header using the raw value.
(Inherited from MimeEntity) |
| SetHeader(String, String) |
Set the value of a header.
(Inherited from MimeEntity) |
| ToString |
Return a String that represents the MimeEntity for debugging purposes.
(Inherited from MimeEntity) |
| TryInit |
Tries to use the given object to initialize the appropriate property.
(Inherited from MimeEntity) |
| VerifyContentMd5 |
Verify the Content-Md5 value against an independently computed md5sum.
(Inherited from MimePart) |
| WriteTo(Stream, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteTo(String, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteTo(FormatOptions, Stream, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteTo(FormatOptions, String, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteTo(Stream, Boolean, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteTo(String, Boolean, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteTo(FormatOptions, Stream, Boolean, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteTo(FormatOptions, String, Boolean, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteToAsync(Stream, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteToAsync(String, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteToAsync(FormatOptions, Stream, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteToAsync(FormatOptions, String, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteToAsync(Stream, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteToAsync(String, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) |
| WriteToAsync(FormatOptions, Stream, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) |
| WriteToAsync(FormatOptions, String, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) |