Free Support Forum -

Iterate items in entire PST- instead of a folder

I'm starting to use Aspose.Network.Outlook.Pst to iterate items within a PST or OST.

I can do this:

PersonalStorage ost = PersonalStorage.FromFile(filePath);
FolderInfo folder = ost.RootFolder;
MessageInfoCollection messages = folder.GetContents();

I can then iterate the items in 'messages', but the collection only contains the items in THAT folder.

What I really need to do is iterate the entire PST as a single edb table, finding whether each successive item is a message, folder, calendar item, or whatever, and getting properties of each one based on type.

Is there a way to do this? I don't want to use recursion like the OST example I've seen, because my iterator block uses 'yield return'.

Thank you for any info,


Thank you for inquiry.

I don’t want to use recursion like the OST
example I’ve seen, because my iterator block uses ‘yield return’.

Could you please explain this further, I could not get it.

The PST manages messages and other items in folders and our API also uses folders for listing the messages. To read the whole PST, using recursive methods is the easiest way, because the depth of sub-folders is not known in advance.