I get this error when processing the attached OLM. It converts in other tools correctly.
class com.aspose.email.system.exceptions.FormatException: One of the identified items was in an invalid format.
this error occures when calling the olmstorage enumerateMapiMessages the OLMFolder enumerateMessages methods or from folders in the OLM attached,bill_rapp.zip (780.1 KB)
I have used following sample code using Aspose.Email for Java 20.12 on my end for shared OLM file. I couldn’t observe any exception and the code executed correctly. Can you please try using following sample code.
public static void PrintMessageCount(List<OlmFolder> folders,OlmStorage storage) {
for (OlmFolder folder : folders) {
// print the current folder path
System.out.println("Message Count [" + folder.getName() + "]: " + folder.getMessageCount());
if (folder.hasMessages())
{
// extract messages from folder
for (MapiMessage msg : storage.enumerateMessages(folder))
{
System.out.println("Subject: " + msg.getSubject());
}
}
}
}
public static void TestOLMFile()
{
String file="bill_rapp.olm";
String path="//Users//mudassirkhan//Downloads//";
OlmStorage storage = new OlmStorage(path + file);
PrintMessageCount(storage.getFolderHierarchy(),storage);
}