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

Free Support Forum - aspose.com

PST issue with FolderInfoCollection and MessageInfoCollection

Sorry I failed to include the PST in my last Post. Here is everything again including the PST.

Below is a copy of my other post comments.Hopefully pst named Aspose Test PST.pst zipped and is ok.

I loaded Net 1.4.0


1. In The Folder list FolderInfoCollection - folderInfo.ContentCount always = 0. Should be number of messages in the folder.
2. In The Folder list MessageInfoCollection - messageInfo.Subject returns spaces.

More serious Issues

If I load the PST with several messages then extract them I am getting the wrong messages. The attached PST has 1 Inbox message,
1 Drafts message and 1 deleted items message. I used WebDAV messages named "WebDAV Import" to load the PST. I named messages
extracted from the PST with Aspose software "Aspose Export". I also extracted messages from the PST using a different software tool
and they are named "Another Export".

WebDAV Import Inbox Message 1.msg Matches
Another Export Inbox 1.msg Matches
Aspose Export Inbox 1.msg Completely Different

WebDAV Import Drafts Message 1.msg Matches
Another Export Drafts 1.msg Matches
Aspose Export Drafts 1.msg Completely Different (Looks like same message as Aspose Export Inbox 1.msg)

WebDAV Import Deleted Items Message 1.msg Matches
Another Export Deleted Items 1.msg Matches
Aspose Export Deleted Items 1.msg Completely Different

The attached .zip contains all the .msg files, the PST and code snippets for how I created the PST,
How I loaded it with messages, How I did the Folder Collection and how I exported the messages.

I think the PST is fine, but the code I am using to examine the PST contents is generating bad results.


Hi Tom,

Thank you for providing the sample PST.

I am unable to open any of the WebDav messages in Outlook 2010, instead I have to use some third party tool to examine the message contents. So, I believe that the problem is with the sample message files that you are adding to the PST, not with your source code. Moreover, I have noticed that after adding to PST, the fields such as To, From and Subject are replaced with empty strings but when extracted from the PST, these messages have Japanese characters as the Subject field [please check attachment].

Two tickets have been logged into our tracking system. The details are as below,
  1. NETWORKNET-33145: To investigate the problem of FolderInfo.ContentCount.
    I can confirm that the ContentCount for every folder is zero.
  2. NETWORKNET-33146: To investigate the problem of empty message string as Subject of the message in PST file and
    Japanese characters in Subject when extracted.
I also believe that the message miss-match issue as discussed in your original post is related to the ticket NETWORKNET-33146.

We will keep you posted with updates on these issues.

I will retest using some Net 2010 messages. Please understand that when I use a different PST Library from Independentsoft.de to Import the PST it works perfect. Subject, message, everything looks exactly as the WebDAV message. I have no clue where the Funny characters are coming from. The Independentsoft.de PST software can read the PST ok but the Aspose software does not. Also, I am unable to read the WebDAV .msg files using outlook. I can read them as .eml files using Mozilla Thunderbird and they look fine using that software. The Independentsoft.de PST Library will not create a PST, but will read an existing one. We would like to be able to create as well as read it back. That is why your software is of interest to us.

Hi Tom,

Thank you for your interest in Aspose products.

I hope the issues that you are facing right now will soon be sorted out. I am in contact with the development team on these issues and I will keep you posted with updates.

[Edited] We are not able to open WebDav messages in Outlook cause they are of EML format with wrong extension. If you change the extension to .eml then these messages can be viewed using MS Outlook.

Having never used your products I struggle to find specific code examples for PST usage. Can you point me to where these are at? So far I have been using other forum PST questions to try and find code examples. Thanks

Hi Tom,

Please find below some useful links. In case you have some other requirement that you are unable to find in below linked Technical Articles then please let us know, we can prepare sample codes for that.


Do you have a code sample to get the full path and folder names in the path? I found a reference to FolderInfo.RetrieveFullPath() but I do not know how to code the full example. Thanks for the other code examples.

Hi Tom,

Please find below the sample source for your need,

using (var pst = Aspose.Email.Outlook.Pst.PersonalStorage.FromFile(“E:\items.pst”))
var root = pst.RootFolder;
foreach (var folder in root.GetSubFolders())
if (folder.HasSubFolders)
foreach (var subfolder in folder.GetSubFolders())

I have continued to test message import/export and here is what I find. You may have reported this condition, but this is what I have tested.

1. Within Outlook I created a PST and Folder Inbox and placed some messages in the Inbox.

2. Aspose software will correctly export them to .msg files and they can be read by outlook by

clicking on them.

3. If I take one of these messages and load it back into the PST Inbox it displays incorrectly,

no subject and the message body is just alpha/numeric data. The same happens if I load

a WebDAV or Exchange NET 2010 message. Valid messages export to DASD just fine, but I can not get anything to load from DASD back into the PST and work.

You should be able to replicate this by taking any PST and loading some messages and see what you get.

Let me know when a fix is available, or if you can not replicate this issue, or if you need any of my test data.

Hi Tom,

Thank you for your patience and consideration.

We have been able to sort out the problem logged earlier under ticket Id NETWORKNET-33146. As discussed here, the messages shared by you having the prefix “WebDav” are actually of EML format and have Unicode characters. This fact changes the logic for loading these messages into a PST file. You need to explicitly specify the Unicode format while adding them to some PST folder. Please check the below source code and attached PST file for your reference.

//Create a new PST
using(var pst = Aspose.Email.Outlook.Pst.PersonalStorage.Create(“test5.pst”, FileFormatVersion.Unicode))
//Get Root of PST
FolderInfo root = pst.RootFolder;
//Add a folder at Root of PST by name of Inbox
//Get Inbox folder
FolderInfo inbox = root.GetSubFolder(“Inbox”);

//Load the WebDav message into an instance of MailMessage
MailMessage mailmessage = MailMessage.Load(“WebDAV Import Inbox Message 1.eml”);
//Add MailMessage into an instance of MapiMessage and add MapiMessage to Inbox folder of PST
inbox.AddMessage(MapiMessage.FromMailMessage(mailmessage, OutlookMessageFormat.Unicode));
mailmessage = MailMessage.Load(“WebDAV Import Inbox Message 1.msg”);
inbox.AddMessage(MapiMessage.FromMailMessage(mailmessage, OutlookMessageFormat.Unicode));

Please give it a try at your end and feed us back.

Thanks and Regards,

So far the Unicode translation is working fine with both WebDAV and Exchange messages.

One question for now is can I process the message as a text string without sending it to DASD first? MailMessage.Load seems to always want to retrieve the message from DASD.


Hi Tom,

Thank you for your feedback.

I am afraid, I have never encountered such scenario where I have to load a message from a string. Also, I believe there are no means available to fulfil your requirement by using the current implementation of Aspose.Email component.

I will dig into it to find an appropriate solution for your need.

Not a problem for me as is. Thanks

Did NETWORKNET-33145 get resolved? I'm running into the same using v3.2.1.0 of Aspose.Email (.Net)

folder.ContentCount = 0

where as folder.GetContents().Count = 528 (in my case).

So wondering if this ticket has been since close/resolved?



Hi Greg,

NETWORKNET-33415 has been solved already as in version 1.5 of Aspose.Email for .NET. I tried the following code using Aspose.Email for .NET 3.2.1 by creating a PST and adding a message to it. Then, both the counts were displayed and they were equal. Please try the following code at your end and let us know your feedback.

Sample Code:


PersonalStorage pst = PersonalStorage.Create("EMAIL_490021\\AsposePst.pst", FileFormatVersion.Unicode);

FolderInfo fi = pst.CreatePredefinedFolder("Inbox", StandardIpmFolder.Inbox);

fi.AddMessage(MapiMessage.FromFile("EMAIL_490021\\About Aspose.msg"));


MessageInfoCollection coll = fi.GetContents();