MimePartCollectionItem Property (String)
Gets the MIME part by the specified Content-Type.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public MimePart this[
	string name
] { get; }

Parameters

name
Type: SystemString
The Content-Type of the MIME part to be searched in the collection.

Property Value

Type: MimePart
A MimePart object which has ContentType value equal to the specified name; or a null reference (Nothing in Visual Basic) if the collection does not contain such MimePart objects.
Remarks

The search is case-sensitive. For instance, if name is text/plain while ContentType of the MIME part is TEXT/PLAIN, that MimePart object will still be returned.

If multiple MimePart objects in the collection meet the specified search condition, only the first found object will be returned.

Examples
This sample loads the message from .EML file and displays the size of XML body of the message if any.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class).
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");
MimePart xmlPart = msg.MimePartTree.GetAllParts()["text/xml"];
if (xmlPart != null)
{
    Console.WriteLine(xmlPart.Size.ToString());
}
else
{
    Console.WriteLine("No such MimePart.");
}
See Also