MapiMessage.getMessageClass() returns IPM.Note for Task- Post and ReportEmail types

An Outlook message class identifies a type of Outlook item. The following table lists these eight standard types of items and their message class names.

Outlook Item Type Message Class Name

AppointmentItem IPM.Appointment
ContactItem IPM.Contact
DistListItem IPM.DistList
JournalItem IPM.Activity
MailItem IPM.Note
PostItem IPM.Post or IPM.Post.RSS
TaskItem IPM.Task


But Aspose returns IPM.Note as the message class name for Task, Post or Report email types too.


Hi,


Thank you for contacting Aspose support team.

I have tested few of the samples available here and found that Aspose displays proper message class. I used following sample code with the attached message files.

MapiMessage SampleTask = MapiMessage.fromFile(“SampleTask.msg”);
System.out.println("Sample Task Message Class = " + SampleTask.getMessageClass());

MapiMessage SampleAppointment = MapiMessage.fromFile(“SampleAppointment.msg”);
System.out.println("Sample Appointment Message Class = " + SampleAppointment.getMessageClass());

MapiMessage SamplePost = MapiMessage.fromFile(“SamplePost.msg”);
System.out.println("Sample Post Message Class = " + SamplePost.getMessageClass());

MapiMessage SampleContact = MapiMessage.fromFile(“SampleContact.msg”);
System.out.println("Sample Contact Message Class = " + SampleContact.getMessageClass());
Could you please give it a try and let us know your feedback? If it does not resolve the issue, please send us the sample console application along with the sample files. It will help us to re-produce the issue here and provide assistance as soon as possible.

Following is the sample output of the above program:

Sample Task Message Class = IPM.Task
Sample Appointment Message Class = IPM.Appointment
Sample Post Message Class = IPM.Post
Sample Contact Message Class = IPM.Contact

Hi Kashif,

Thanks for the immediate reply.
In our application instead of creating the MapiMessage instance directly from file, we are creating a MailMessage and then creating a MapiMessage instance from this mail message.
In this case, the message_class attribute is always returned as IPM.Note.
Please find the code below.
MailMessage message = MailMessage.load(inputFile, MessageFormat.getMsg());
MapiMessage mapiMsg = MapiMessage.fromMailMessage(message);
String msgClass = mapiMsg.getMessageClass();

We require the MailMessage Instance too because we need to get the values of sensitivity, priority and message_id also.
Could you please look into why there is a difference in the value returned for messageclass.
Thanks,
Sadhana


Hi Sadhana,


MailMessage doesn’t support any other items except regular messages, that’s why when loading msg in MailMessage, the type information is lost. Thus, when converting to MapiMessage again, we get IPM.Note. In your case you may need to instantiate both types and retrieve required information.

Please feel free to write us back if you have any other query related to Aspose.Email.