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");
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.
Hi Sumit,
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.