Sample code to get all notes from PST:
// load the Outlook PST file
string strBaseFolder = @”C:\Emails\”;
string strPSTFile = @”PersonalFolders.pst”;
PersonalStorage pst = PersonalStorage.FromFile(strBaseFolder + strPSTFile);
// get the folders and messages information
FolderInfo folderInfo = pst.RootFolder;
// Get subfolders
if (folderInfo.HasSubFolders == true)
{
foreach (FolderInfo subfolderInfo in folderInfo.GetSubFolders())
{
// We only need notes information
if (subfolderInfo.DisplayName == “Notes”)
{
MessageInfoCollection messageInfoCollection = subfolderInfo.GetContents();
foreach (MessageInfo messageInfo in messageInfoCollection)
{
// get note
MapiMessage message = pst.ExtractMessage(messageInfo);
MapiNote note = message.ToMapiMessageItem() as MapiNote;
Console.WriteLine(“Subject: ” + note.Subject);
Console.WriteLine(“Body: ” + note.Body);
}
}
}
}
string strBaseFolder = @”C:\Emails\”;
string strPSTFile = @”PersonalFolders.pst”;
PersonalStorage pst = PersonalStorage.FromFile(strBaseFolder + strPSTFile);
// get the folders and messages information
FolderInfo folderInfo = pst.RootFolder;
// Get subfolders
if (folderInfo.HasSubFolders == true)
{
foreach (FolderInfo subfolderInfo in folderInfo.GetSubFolders())
{
// We only need notes information
if (subfolderInfo.DisplayName == “Notes”)
{
MessageInfoCollection messageInfoCollection = subfolderInfo.GetContents();
foreach (MessageInfo messageInfo in messageInfoCollection)
{
// get note
MapiMessage message = pst.ExtractMessage(messageInfo);
MapiNote note = message.ToMapiMessageItem() as MapiNote;
Console.WriteLine(“Subject: ” + note.Subject);
Console.WriteLine(“Body: ” + note.Body);
}
}
}
}
We also fixed some bugs, which were reported in forums by customers. For release notes and download, please visit http://www.aspose.com/community/files/51/.net-components/aspose.network-for-.net/default.aspx.