MapiMessageRemoveAttachments Method

Removes all of the attachments from the specified Outlook Message files.

Namespace:  Aspose.Email.Mapi
Assembly:  Aspose.Email (in Aspose.Email.dll) Version: 22.4
Syntax
public static MapiAttachmentCollection RemoveAttachments(
	string path
)

Parameters

path
Type: SystemString
The name of the Outlook Message file.

Return Value

Type: MapiAttachmentCollection
The attachments collection.
Examples

The following exmaple demonstrates how to destroy attachments in Outlook Message files.

[C#]

//Remove attachments from Outlook Message files
MapiAttachmentCollection attachments = MapiMessage.RemoveAttachments(@"c:\outlookmessage.msg");

//Attachments
foreach(MapiAttachment att in attachments)
{
   Console.WriteLine("Attachment Name:"+att.FileName);
   att.Save(att.FileName);
}

[Visual Basic]

'Remove attachments from Outlook Message files
MapiAttachmentCollection attachments = MapiMessage.RemoveAttachments("c:\outlookmessage.msg");

'Attachments 
For Each att As MapiAttachment In msg.Attachments 
     Console.WriteLine("Attachment Name:" + att.FileName) 
     att.Save(att.FileName) 
Next
See Also