PstReaderGetPstRootFolders Method (Boolean)
Gets the list of root folders which are present in the .PST file or stream.

Namespace: MailBee.Outlook
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public PstFolderCollection GetPstRootFolders(
	bool includeSubFolders


Type: SystemBoolean
If true, all subfolders will be included in the resulting list; otherwise, only the top level folders without their own sub-folders.

Return Value

Type: PstFolderCollection
A PstFolderCollection object representing the folder collection.

The returned folders may contain their own sub-folders and other items like e-mail messages, contacts, appointments, tasks, etc.

includeSubFolders is true, you'll get all the folders on all nesting levels as a single flat list. When iterating through this list, you can use Name property to get full folder name including all parent folder names. ShortName gives you the name of the folder itself.

If you're not using flat list and specified includeSubFolders as false, you can still get the list of sub-folders for each folder using its GetPstSubFolders(Boolean) method (and then recursively repeat the same if sub-folders have their own sub-folders, etc).

The delimiter which is used to separate levels of folder names is: "\".

The example is available in PstReader topic. That example specifies includeSubFolders as true and thus all folders and sub-folders are returned as a single flat list. Thus, there is no need to use recursion in order to traverse through the entire folder tree.
See Also