Read Outlook PST File and Get Folders and Subfolders Information
Load a PST File
An Outlook PST file can be loaded into an instance of the PersonalStorage class. A code snippet for loading the PST file is given below:
Displaying Folders Information
After loading the PST file into the PersonalStorage class, you can get the information about the file display name, root folder, subfolders and messages count. The following code snippet displays the name of a PST file, folders and number of messages in the folders:
Get user-defined folders only
A PST/OST files may contain folders that were created by the user. Aspose.Email provides the ability to access only user-defined folders by using the PersonalStorageQueryBuilder.OnlyFoldersCreatedByUser property. You can set the PersonalStorageQueryBuilder.OnlyFoldersCreatedByUser property to true to get only user-defined folders. The following code snippet demonstrates the use of PersonalStorageQueryBuilder.OnlyFoldersCreatedByUser to get user-defined folders.
Parse Searchable Folders
A PST/OST may contain searchable folders in addition to the normal type of folders. Aspose.Email provides the FolderKind enumerator for specifying the messages from such search folders with EnumerateFolders and GetSubFolders methods.
Retrieve Parent Folder Information from MessageInfo
The following code snippet shows you how to retrieve parent folder information from MessageInfo.