Corrupt PST file created

Hi,

I’m trying to convert multiple EML files to one PST file and I’m facing the problem that the created PST file is corrupt. This is the code I’m using:

==========================================================
public synchronized void convert(Path path, Path pstFilename) throws IOException {
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Convert path {0}”, path);
long timeStart = System.currentTimeMillis();
List emlList = fileList(path);

int i = 0;
try (OutputStream out = Files.newOutputStream(pstFilename, StandardOpenOption.CREATE)) {
PersonalStorage pst = PersonalStorage.create(out, 0);
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Create PST: {0}”, path);
// Create a folder at root of pst

FolderInfo info = pst.getRootFolder().addSubFolder(“migration”);
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Create Folder Inbox”, path);
for (String emlStr : emlList) {
if (StringUtils.endsWithIgnoreCase(emlStr, “eml”)) {
i++;
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Load eml: {0}”, emlStr);
Path emlPath = Paths.get(emlStr);
try (InputStream emlIn= Files.newInputStream(emlPath, StandardOpenOption.READ)) {
MailMessage eml = MailMessage.load(emlIn);
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Convert mailMessage: {0}”, eml.getSubject());
info.addMessage(MapiMessage.fromMailMessage(eml, MapiConversionOptions.getUnicodeFormat()));
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Added to PST”);
}
}
}
pst.dispose();
}
long timeEnd = System.currentTimeMillis();
eventService.postEvent(EventTopics.LOG, LogLevel.DEBUG, “Closed PST with {1} emls in {2} msec: {0}”, path, i, timeEnd
- timeStart);
}
==========================================================

The created PST file can be opened in Outlook 2010 and I can see and open all emails but when I check the PST file with the tool “scanpst.exe” which is part of the Outlook installation I get the message that there are errors in the PST. This is the output of “scanpst.exe”:

==========================================================

Microsoft ® Inbox Repair Tool
Copyright © Microsoft Corp 1995-1996. All rights reserved.

**Beginning NDB recovery

**Attempting to open database

**Attempting to validate header

**Attempting to validate AMap

**Attempting to validate BBT

**Attempting to validate NBT

**Attempting to validate BBT refcounts

**Attempting to validate header NID high-water marks

**Beginning PST/OST recovery

**Attempting to recover all top-level objects

!!Missing the outgoing queue

!!Missing template (nid=6B6)

!!Missing template (nid=6D7)

!!Missing template (nid=6F8)

!!HMP not found - creating

**Attempting to walk all folders

!!Attachment (nid=8045) missing or invalid PR_ATTACH_SIZE

!!Attachment table for 200024, row doesn’t match sub-object:
irow = 1, RowID = 8045

!!Attachment (nid=8025) missing or invalid PR_ATTACH_SIZE

!!Attachment table for 200024, row doesn’t match sub-object:
irow = 0, RowID = 8025

**Attempting to locate any orphaned folders/messages

**Performing final HMP validation

**Attempting to check top-level objects for consistency

??Deleting SDO

**Updating folder hierarchy

**Attempting to fix original file

**Attempting to copy back BBT

**Attempting to copy back NBT

==========================================================

Any idea what went wrong?

Hi Malte,

Thank you for writing to Aspose Support team.

This behavior of the API is known to us and we are still working to find out the reasons of these errors reported by ScanPst. Though the resultant PST file can be opened in MS Outlook and messages can be opened/analyzed, it still exhibits some issues with the PST structure that we have plan to investigate further under issue id: EMAILNET-34836. Once there is some update available about this issue, we’ll notify you here via this thread.

I can confirm that the generated PST files can be opened in Outlook and it seems that everything is OK, but they are corrupt. Due to this fact they are not compatible with IBM Content Collector for Email. When I try to import the generated PST files in ICC the import process stucks so this API is worthless for my project… :frowning: Any plan when this issue will be fixed?

Hi Malte,

Please share your sample EML files with us so that we can generate such a PST from it and log the issue for consideration by our Product team. Though the issue is known, it may be that your reported errors are different than the ones already known and the issue may miss the exist fix. Please share the files for our investigation. We’ll look into these and assist you further.

P.S. my problem is that I need a tool for PST generation which is compatible with IBM Content Collector and this problem prevents me from using the Aspose.Email library. If I cant get a fix for this issue quickly I have to look for other solutions :frowning: So I need at least a statement when a fix could be available…

I’ve attached two samples - one PST with just one email and one PST with 777 emails. In the folder eml_original you’ll find the EML files, in the folder after_convert the PST files generated by Aspose.Email lib, and in the flder after_repair the PST files after a repair by scanpst.exe and the corresponding log files.


P.S. It seems that the original zip with both samles is too big so I’ve splitted them into sample1 and sample2_1 and sample2_2

Hi,

Thank you for sharing the sample EML files.

We have logged this issue as EMAILJAVA-33563 in our issue tracking system for further investigation by our Product team. Once the issue is investigated and there is a fix version available, we’ll update you here via this thread.

Hi! Any news for this issue? I need as soon as possible a comment on the expected resolve time because this is essential for my purchase decision of Aspose.Email.

Hi,


I have checked status of this ticket and observed that there are still other high priority tasks which are are under progress. This issue will be analyzed on its turn and then product team will share their feedback. I am afraid that no ETA can be provided at this stage and you will be automatically notified once issue is analyzed and feedback is provided by the developers.

The issues you have found earlier (filed as EMAILJAVA-33563) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan