MailBee.NET Objects 4.0

MimePart.SubParts Property

Gets the collection of all immediate sub-parts of the MIME part.

public MimePartCollection SubParts {get;}

Property Value

A reference to the collection of all immediate sub-parts of the MIME part, or a null reference (Nothing in Visual Basic) if this MIME part is not multi-part.

Remarks

This property contains the collection of immediate sub-parts of the MIME part. To get the MIME part and all its sub-parts (including sub-sub-parts) as a flat list, use GetAllParts method.

Example

This sample loads the message from .EML file and displays the content type of each MIME part of the message.

[C#]
// 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");
if (msg.MimePartTree.SubParts != null)
{
    foreach (MimePart part in msg.MimePartTree.SubParts)
    {
        Console.WriteLine(part.ContentType.ToString());
    }
}
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' The actual code (put it into a method of your class).
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")
If Not msg.MimePartTree.SubParts Is Nothing Then
    For Each part As MimePart In msg.MimePartTree.SubParts
        Console.WriteLine(part.ContentType.ToString())
    Next
End If

See Also

MimePart Class | MailBee.Mime Namespace