Read Outlook PST File and Get Folders and SubFolders Information
Aspose.Email for .NET provides an API for reading Microsoft Outlook PST files. You can load a PST file from disk or stream into an instance of the PersonalStorage class and get the information about its contents, for example, folders, subfolders, and messages. The API also provides the capability to include search folders while traversing for messages from the PST folders.
Loading a PST File
An Outlook PST file can be loaded in an instance of the PersonalStorage class. The following code snippet shows you how to load the PST file.
Displaying Folders Information
After loading the PST file in the PersonalStorage class, you can get the information about the file display name, root folder, subfolders and messages count. The following code snippet shows you how to display the name of PST file, folders and number of messages in the folders.
Get user-defined folders only
A PST/OST files may contain folders which 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.
Parsing 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. The following code snippet shows you how to parse searchable folders.
Retrieving Parent Folder Information from MessageInfo
The following code snippet shows you how to retrieve parent folder information from MessageInfo.