AttachmentCollectionItem Property (String) |
Gets the
Attachment object in the collection by the specified filename.
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public Attachment this[
string filename
] { get; }
Public ReadOnly Default Property Item (
filename As String
) As Attachment
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.
using MailBee;
using MailBee.Mime;
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");
Attachment attach = msg.Attachments["my_photo.jpg"];
if (attach != null)
{
attach.SaveToFolder(@"C:\Temp", true);
}
Imports MailBee
Imports MailBee.Mime
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")
Dim attach As Attachment = msg.Attachments("my_photo.jpg")
If Not attach Is Nothing Then
attach.SaveToFolder("C:\Temp", True)
End If
See Also