MapiMessage.RemoveAttachments
Contents
[
Hide
]MapiMessage.RemoveAttachments method
Removes all attachments from an MSG file, overwrites the file, and returns the removed attachments.
public static MapiAttachmentCollection RemoveAttachments(string path)
| Parameter | Type | Description |
|---|---|---|
| path | String | The path of the MSG file. |
Return Value
The removed attachments.
Exceptions
| exception | condition |
|---|---|
| ArgumentNullException | path is null. |
| ArgumentException | path is empty. |
Examples
This example removes the attachments from an MSG file and saves them to disk.
[C#]
MapiAttachmentCollection attachments = MapiMessage.RemoveAttachments(@"c:\messages\message.msg");
foreach (MapiAttachment attachment in attachments)
{
Console.WriteLine("Attachment: " + attachment.LongFileName);
attachment.Save(Path.Combine(@"c:\attachments", attachment.LongFileName));
}
[Visual Basic]
Dim attachments As MapiAttachmentCollection = MapiMessage.RemoveAttachments("c:\messages\message.msg")
For Each attachment As MapiAttachment In attachments
Console.WriteLine("Attachment: " + attachment.LongFileName)
attachment.Save(Path.Combine("c:\attachments", attachment.LongFileName))
Next
See Also
- class MapiAttachmentCollection
- class MapiMessage
- namespace Aspose.Email.Mapi
- assembly Aspose.Email