Mail Priority not getting using MapiMessage

Hi,

I'm trying to extract mails from pst file(s) in MapiMessage collection

trying to read MailPriority attributes using propertytag method given by MapiMessage

but getting null exception.

Please let me know if any solution on this.



Hi,

Thank you for your inquiry.

Please use the code snippet given below to read priority property tag of a Mapi Message. Feel free to contact us in case of any query or comments along with details, sample code snippet and sample input file. We will look into it and update you accordingly.

CODE:
// load the Outlook PST file
com.aspose.email.PersonalStorage pst = com.aspose.email.PersonalStorage.fromFile("Outlook.pst");
// get the folders and messages information
com.aspose.email.FolderInfo folderInfo = pst.getRootFolder();
com.aspose.email.FolderInfo objInbox = folderInfo.getSubFolders().get_Item(1);
// loop through all the messages in this folder
com.aspose.email.MessageInfoCollection messageInfoCollection = objInbox.getContents();
for (int i = 0; i < messageInfoCollection.size(); i++)
{
com.aspose.email.MessageInfo messageInfo = (com.aspose.email.MessageInfo) messageInfoCollection.get_Item(i);

// get the message in MapiMessage instance
com.aspose.email.MapiMessage message = pst.extractMessage(messageInfo);
com.aspose.email.system.collections.IList values = (com.aspose.email.system.collections.IList) new java.util.ArrayList();
values.addItem((float) 1);
values.addItem((float) 2);
com.aspose.email.MapiProperty objProp = new com.aspose.email.MapiProperty(com.aspose.email.MapiPropertyTag.PR_PRIORITY, values);
message.setProperty( objProp);

//Get the MapiProperty
com.aspose.email.MapiProperty prop = message.getProperties().get_Item(com.aspose.email.MapiPropertyTag.PR_PRIORITY);
// DO PROCESSING
}