We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to delete the particular attachment in outlook

Hi sir



From your post i take this lines

“MapiMessage.RemoveAttachments(“c:\temp\outlookmessage.msg”)”
"MapiMessage.DestroyAttachments(“c:\temp\outlookmessage.msg”)"
in this it delete the all attachment.


NOTE
In my email i have 4 attachment i want to delete 2 & 4th attachmetn remaining attachment i want to save as .msg format

Hi Senthil,


Thank you for writing to Aspose support team.

You may please use following sample code to remove required attachments from the MapiMessage and let us know the feedback.

var message = MapiMessage.FromFile(@“C:\temp\SampleMessage.msg”);<o:p></o:p>

var attachments = message.Attachments;

MapiAttachment att1 = attachments[1];

MapiAttachment att2 = attachments[3];

attachments.Remove(att1);

attachments.Remove(att2);

message.Save("C:\\temp\\out.msg");