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

Free Support Forum - aspose.com

How to retrieve message using message Id?

How to retrieve message and save in the disk (msg format) using message Id using Aspose.Email using C# without reading whole PST file?

Hi Sumit,

Thank you for writing to Aspose support team.

You can use the PersonalStorageQueryBuilder class object to search for the message using the message id. Once the results are available, the message can be extracted directly and saved to disc without searching the whole folder. The following example demonstrates how to achieve this. Please feel free to write to us if you have any additional query/inquiry in this regard.

Sample Code:

PersonalStorage pst = PersonalStorage.FromFile(“SomePstFile.pst”);<o:p></o:p>

FolderInfo folder = pst.RootFolder.GetSubFolder("Inbox");

PersonalStorageQueryBuilder builder = new PersonalStorageQueryBuilder();

builder.MessageId.Equals("some message id"); //input the message id criteria

MessageInfoCollection messages = folder.GetContents(builder.GetQuery());

MapiMessage mapi = pst.ExtractMessage(messages[0]); //Save the mapi message extracted

Hello sir, thank you for reply.

but when i applied builder.MessageId.Equals(“some message id”);
it is giving me error like “pst searching engine does not support “MessageId” as field name”.
Can you please help me to find out solution?

Hi Sumit,

Thank you for providing the feedback.

I was able to observe the issue you have mentioned and have logged it as NETWORKNET-34427 in our issue tracking system for further investigation by our development team. We’ll update you here once there is some update or fix version available in this regard.

The issues you have found earlier (filed as NETWORKNET-34427) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.