Browse our Products

Aspose.Email for Java 20.10 Release Notes

All Changes

KeySummaryCategory
EMAILNET-39952Page Data is not valid when loading folder in OSTEnhancement
EMAILNET-39947Issue on PST to EML conversion (extractionTest.PST)Bug
EMAILNET-39950MergeWith(stream[]) not working for empty PSTBug
EMAILNET-39951BodyEncoding is null while emails fetching from serverBug
EMAILJAVA-34747How to change MapiNote creation dateBug
EMAILNET-39955The Msg file is interpreted as corrupted, but opens in Outlook without errorBug
EMAILJAVA-34751Exception on loading VCF fileBug

New features

Reading corrupted PST/OST files

Sometimes it may not be possible to read the PST/OST due to some issues. For example, some data blocks may be corrupted. In such cases, exceptions usually arise when calling the EnumerateFolders, EnumerateMessages, GetContents, GetSubfolders, etc. methods. But individual messages or folders may remain undamaged in the storage.

We have added methods that allow to find item identifiers in a hierarchical manner. Further, you can extract items by identifiers.

  • PersonalStorage.findMessages(String parentEntryId) - finds the identifiers of messages for the folder.
  • PersonalStorage.findSubfolders(String parentEntryId) - finds the identifiers of subfolders for the folder.

Note, that despite the advantages, there are corrupted storages that cannot be read even using these methods.

Code sample:

try (PersonalStorage pst = PersonalStorage.fromFile(fileName)) {
    exploreCorruptedPst(pst, pst.getRootFolder().getEntryIdString());
}

public static void exploreCorruptedPst(PersonalStorage pst, String rootFolderId) {
    Iterable<String> messageIdList = pst.findMessages(rootFolderId);

    for (String messageId : messageIdList) {
        try {
            MapiMessage msg = pst.extractMessage(messageId);
            System.out.println("- " + msg.getSubject());
        } catch (Exception e) {
            System.out.println("Message reading error. Entry id: " + messageId);
        }
    }

    Iterable<String> folderIdList = pst.findSubfolders(rootFolderId);

    for (String subFolderId : folderIdList) {
        if (subFolderId != rootFolderId) {
            try {
                FolderInfo subfolder = pst.getFolderById(subFolderId);
                System.out.println(subfolder.getDisplayName());
            } catch (Exception e) {
                System.out.println("Message reading error. Entry id: " + subFolderId);
            }

            exploreCorruptedPst(pst, subFolderId);
        }
    }
}