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

Free Support Forum - aspose.com

Embedded Attachments

How can I determine what type of attachment is embedded?
Some attachments are email, calendar items, or pdf files. Since the display and file name of the attachment generally don’t have an extension I’m not sure what type of attachment it is.

Thanks,
//Christopher

Hi Christopher,


Thank you for writing to Aspose Support team.

The Attachment’s class getContentType.getName() returns the attachment name in all the cases. If this is not available, you can use the getContentType.getMediaType() to get information about the attachment type. Please try it at your end and share your feedback with us.

Unfortunately the method you’ve given is for the AttachmentBase class which the MapiAttachment doesn’t extend.

I was able to use the method getExtension() for now.

Thanks.

Hi Christopher,


Thank you for sharing your feedback. In our response, we assumed that you are using MailMessage and that is why we suggested the Attachment class. Anyways, since you have found the method to get this information, please feel free to write to us if you have any other query related to the API.