AttachmentCollectionItem Property (String)
Gets the Attachment object in the collection by the specified filename.

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

Parameters

filename
Type: SystemString
The unique filename of the attachment in the collection (as returned by the Filename property).

Property Value

Type: Attachment
An Attachment object having the specified unique filename, or a null reference (Nothing in Visual Basic) if the attachment with the specified unique filename does not exist in the collection.
Examples
This sample loads the message from .EML file and saves the specified attachment to disk.
// 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)

// Load the message from file.
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");

// Access the attachment in the collection by the unique name.
Attachment attach = msg.Attachments["my_photo.jpg"];

// When there is an attachment...
if (attach != null)
{
    // Save the attachment to folder.
    attach.SaveToFolder(@"C:\Temp", true);
}
See Also