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

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


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.

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.

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();
MimePart xmlPart = msg.MimePartTree.GetAllParts()["text/xml"];
if (xmlPart != null)
    Console.WriteLine("No such MimePart.");
See Also