Free Support Forum - aspose.com

Issue with recursively traversing OST folders

Using Aspose.Email for .NET 5.3.

I have an OST file, and I’m trying to recursively walk the folder structure. When I get to the folder “Root - Mailbox\Finder”, the folder’s HasSubFolders property is TRUE, but I am unable to get a list of the subfolders through either the GetSubFolders() or EnumerateFolders() methods.

If I use a competing product (IndependentSoft) I am able to examine the folders underneath “Finder”. Also, if I have the entryId, I can directly access the folder by calling PersonalStorage.GetFolderById().

I saw an post from about three years ago indicating that “Search folders are no longer listed as of version 1.7 of Aspose.Email”. I assume that’s the issue here. But it seems to me that this is somewhat broken, given both the value of HasSubFolders, and that it IS possible to directly access these folders if you know their IDs. I can’t understand why you can’t also walk them.

Hi Tony,


Thank you for posting your query.

Can you please share your sample OST file with us for investigation of this issue at our end? As you mentioned that this issue doesn’t arise with version 1.7 of the API, we need to compare this issue with our older version to report it as regression. Please share that respective forum thread as well alongwith your sample code. We shall look into it and assist you further as soon as further.

Muhammad,



I have sent you a private email containing the OST in question, as well as some additional test data.



The previous thread I referred to is here: http://www.aspose.com/community/forums/permalink/364365/364072/showthread.aspx#364072

Hi Tony,


We have tried a number of times to read this OST file using Aspose.Email API, but it always gives Access is denied error. Could you please share your sample Aspose.Email code that you are using to read and parse the information from this OST. We need your assistance to investigate this issue further at our end and will be thankful to you for the same.

Here’s a simplified version of the code I’m using. (I’ve tested it and it reads the OST successfully.)

// Open an OST and get the name and
// parent name for all folders in the file
private void WalkAllFolders()
{
var path = @“C:\Edoc.ost”;
byte[] buffer = System.IO.ExtendedFile.ReadAllBytes(path);
using (Stream s = System.IO.ExtendedFile.OpenRead(path, buffer))
{
PersonalStorage pst = PersonalStorage.FromStream(s);
IList folderData = new List();
WalkFolders(pst.RootFolder, “N/A”, folderData);
var foo = “foo”;
}
}

// Walk the folder structure recursively
private void WalkFolders(FolderInfo folder, string parentFolderName, IList folderData)
{
string displayName = (string.IsNullOrEmpty(folder.DisplayName)) ? “ROOT” : folder.DisplayName;
string folderNames = string.Format(“DisplayName = {0}; Parent.DisplayName = {1}”, displayName, parentFolderName);
folderData.Add(folderNames);
if (!folder.HasSubFolders)
{
return;
}
foreach (FolderInfo subfolder in folder.GetSubFolders())
{
WalkFolders(subfolder, displayName, folderData);
}
}

Attached is a text file with the code properly formatted.

Hi Tony,


Thank you for providing the sample code and OST.

I have tested the scenario and observed that using Aspose.Email for .NET 1.6.0, we can retrieve the sub-folders in the “Finder” sub-folder where as using Aspose.Email for .NET 5.4.0, it returns 0 count. I have also observed that using EntryId we can retrieve the Finder sub-folders using AE 5.4.0.

I have logged this issue as Id:EMAILNET-34817 in our bug tracking system for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.

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


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