Wiki

Clone wiki

Aspose for Apache POI / Read-Outlook-Storage-PST

Aspose.Email

// Load the Outlook PST file
String pstFileName = "data/archive.pst";
PersonalStorage pst = PersonalStorage.fromFile(pstFileName);

// Get the Display Name of the PST file
System.out.println("Display Name: " + pst.getDisplayName());

// Get the folders information
FolderInfoCollection folderInfoCollection = pst.getRootFolder().getSubFolders();
// Browse through each folder to display folder name and number of messages
for (int i = 0; i < folderInfoCollection.size(); i++)
{
    FolderInfo folderInfo = (FolderInfo) folderInfoCollection.get_Item(i);
    System.out.println("Folder: " + folderInfo.getDisplayName());
    System.out.println("Total items: " + folderInfo.getContentCount());
    System.out.println("Total unread items: " + folderInfo.getContentUnreadCount());
    System.out.println("-----------------------------------");
}

Download Source Code

For More Examples, Please Visit Aspose Docs

Updated