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

Free Support Forum - aspose.com

How to read only mails from PST file using Aspose.Email For Java

I have to read only mails from PST file. I am using Aspose.Email for java API. But while reading all mail, calendar , contacts , notes, journal, task gets read. I have to get only mails and there respected folder name. I am using below code to read messages.


IGenericEnumerable collection =folderInfo.enumerateMapiMessages();
IGenericEnumerator iterator = collection.iterator();
MapiMessage mapiMessage = iterator.next();


There is no direct method to get only the list of mails from a folder. However, you can check the message class of extracted MapiMessage to verify it is of IPM.Note type or not. The following code sample can be used for this purpose:

Sample Code

if (mapiMessage.getMessageClass() == "IPM.Note")
//do something

We have also requested this as enhancement to be included in the Filtering capabilities of items from PST file and will update you here once the feature is available.