Aspose.Email 19.6 Creates a Corrupted PST File in Some Cases

There is a bug in Aspose.Email 19.6. It does not exist in 19.5.

Aspose.Email 19.6 seems to generate a corrupted PST file in some cases. Here is how to reproduce:

var files = Directory.GetFiles(@"c:\messages", "*.msg");

using (var storage2 = PersonalStorage.Create(@"C:\result.pst", FileFormatVersion.Unicode))

{

var folder2 = storage2.RootFolder;

var msgs = files.Take(300).Select(file => MapiMessage.FromStream(new MemoryStream(File.ReadAllBytes(file)))).ToList();

folder2.AddMessages(msgs);

var msgs2 = files.Skip(300).Select(file => MapiMessage.FromStream(new MemoryStream(File.ReadAllBytes(file)))).ToList();

folder2.AddMessages(msgs2);

}

The messages folder contains 509 MSG files. These files are attached. Because it is a big file, please download from: https://www.zevainc.com/download/messages.zip

The bug does not happen if we use AddMessage instead of AddMessages.

The bug does not happen if we use AddMessages a single time. That is if we add the 509 at once.

The bug happens if we add 300 messages and then add the remaining 209 messages.

What is the problem?

The generate PST file has issues. Here is how to see the problem:

Once the result.pst file is generated, add it to outlook as a data file. Then use MFCMAPI (GitHub - microsoft/mfcmapi: MFCMAPI) to open the message with subject “RTF/HTML Email with various attachments”. Once you open the message, try to change a property (e.g. PR_SUBJECT) and then save changes. You will get a MAPI_E_OBJECT_DELETED error.

@bahakh,

I have observed the issue shared by you and request you to please first try using latest Aspose.Email for .NET 19.8 on your end. If the issue still persist then please share the feedback with us and we shall investigate that further on our end.

The issue happens also in 19.8. We already tested it.

@bahakh,

I have observed the issue shared by you and an issue with ID EMAILNET-39582 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hi

Has this issue been resolved? I could not find any release version with EMAILNET-39582 fix.

I’m also seeing a similar issue when creating PSTs with Aspose.Email.
Sometimes the PST created with Aspose ends up with corrupted items. When trying to move those items from the PST into Outlook it fails with the message “Cannot move the items. The item cannot be moved. It was either already moved or deleted, or access was denied”.

Running scanpst.exe I see the following log:

    Microsoft (R) Inbox Repair Tool
� 2018 Microsoft Corporation.  All rights reserved.

Version 16.0.13530.20142


**Beginning NDB recovery

  **Attempting to open database

  **Attempting to validate header

    !!Problems with rgbFP:
      Index 2 points to a PMap past EOF (ibPMap=3E4400)
      Index 3 points to a PMap past EOF (ibPMap=5D4400)
      Index 4 points to a PMap past EOF (ibPMap=7C4400)
      Index 5 points to a PMap past EOF (ibPMap=9B4400)
      Index 6 points to a PMap past EOF (ibPMap=BA4400)
      Index 7 points to a PMap past EOF (ibPMap=D94400)
      Index 8 points to a PMap past EOF (ibPMap=F84400)
      Index 9 points to a PMap past EOF (ibPMap=1174400)
      Index 10 points to a PMap past EOF (ibPMap=1364400)
      Index 11 points to a PMap past EOF (ibPMap=1554400)
      Index 12 points to a PMap past EOF (ibPMap=1744400)
      Index 13 points to a PMap past EOF (ibPMap=1934400)
      Index 14 points to a PMap past EOF (ibPMap=1B24400)
      Index 15 points to a PMap past EOF (ibPMap=1D14400)
      Index 16 points to a PMap past EOF (ibPMap=1F04400)
      Index 17 points to a PMap past EOF (ibPMap=20F4400)
      Index 18 points to a PMap past EOF (ibPMap=22E4400)
      Index 19 points to a PMap past EOF (ibPMap=24D4400)
      Index 20 points to a PMap past EOF (ibPMap=26C4400)
      Index 21 points to a PMap past EOF (ibPMap=28B4400)
      Index 22 points to a PMap past EOF (ibPMap=2AA4400)
      Index 23 points to a PMap past EOF (ibPMap=2C94400)
      Index 24 points to a PMap past EOF (ibPMap=2E84400)
      Index 25 points to a PMap past EOF (ibPMap=3074400)
      Index 26 points to a PMap past EOF (ibPMap=3264400)
      Index 27 points to a PMap past EOF (ibPMap=3454400)
      Index 28 points to a PMap past EOF (ibPMap=3644400)
      Index 29 points to a PMap past EOF (ibPMap=3834400)
      Index 30 points to a PMap past EOF (ibPMap=3A24400)
      Index 31 points to a PMap past EOF (ibPMap=3C14400)
      Index 32 points to a PMap past EOF (ibPMap=3E04400)
      Index 33 points to a PMap past EOF (ibPMap=3FF4400)
      Index 34 points to a PMap past EOF (ibPMap=41E4400)
      Index 35 points to a PMap past EOF (ibPMap=43D4400)
      Index 36 points to a PMap past EOF (ibPMap=45C4400)
      Index 37 points to a PMap past EOF (ibPMap=47B4400)
      Index 38 points to a PMap past EOF (ibPMap=49A4400)
      Index 39 points to a PMap past EOF (ibPMap=4B94400)
      Index 40 points to a PMap past EOF (ibPMap=4D84400)
      Index 43 points to a PMap past EOF (ibPMap=5354400)
      Index 44 points to a PMap past EOF (ibPMap=5544400)
      Index 45 points to a PMap past EOF (ibPMap=5734400)
      Index 46 points to a PMap past EOF (ibPMap=5924400)

  **Attempting to validate AMap

    !!AMap page <@17408> has csFree of 46, but should have 72
    !!AMap page <@525312> has csFree of 38, but should have 104
    !!AMap page <@779264> has csFree of 62, but should have 64
    !!AMap page <@1287168> has csFree of 83, but should have 102
    !!AMap page <@1795072> has csFree of 49, but should have 255
    !!AMap page <@2049024> has csFree of 68, but should have 255
    !!AMap page <@2302976> has csFree of 144, but should have 255
    !!AMap page <@2556928> has csFree of 167, but should have 255
    !!AMap page <@2810880> has csFree of 44, but should have 255
    !!AMap page <@3064832> has csFree of 64, but should have 255
    !!AMap page <@3318784> has csFree of 46, but should have 255
    !!AMap page <@3572736> has csFree of 58, but should have 255
    !!AMap page <@3826688> has csFree of 56, but should have 255

  **Attempting to validate BBT

  **Attempting to validate NBT

  **Attempting to validate BBT refcounts

    ??Couldn't find BBT entry in the RBT (405FC)
    ??Couldn't find BBT entry in the RBT (406B8)
    ??Couldn't find BBT entry in the RBT (485C4)
    ??Couldn't find BBT entry in the RBT (485E4)
    ??Couldn't find BBT entry in the RBT (485E8)
    ??Couldn't find BBT entry in the RBT (4862C)

  **Attempting to validate header NID high-water marks

**Beginning PST/OST recovery

  **Attempting to recover all top-level objects

    **Store created by build: (not available)

  **Attempting to walk all folders

        Failed to add row to the FLT, irow = 1, RowID = 20ACA4
        Failed to add row to the FLT, irow = 0, RowID = 200D64
  **Attempting to locate any orphaned folders/messages

  **Performing final HMP validation

  **Attempting to check top-level objects for consistency

  **Updating folder hierarchy

**Attempting to fix original file

  **Attempting to copy back BBT

  **Attempting to copy back NBT

@mimecast,
Thank you for contacting support.

Far as I can see, our development team investigated the issue but was unable to reproduce the problem. The issue has been closed.

Please check your results using the latest version of Aspose.Email. If the issue persists, please share the following:

  • input email files
  • code example generating the corrupted PST
  • output PST file