We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Corrupt PST files

Hello,

We are using the Aspose.Email product for .Net to create PST files and insert MSG files into them. This is the code we are using:

private List WriteToFolder(List mapiMessageItems, string folderPath, string pathToPstFile)
{
PersonalStorage _personalStorage = PersonalStorage.Create(pathToPstFile, FileFormatVersion.Unicode);
if (string.IsNullOrEmpty(folderPath))
{
return _personalStorage.RootFolder;
}

string[] folders = folderPath.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
FolderInfo folderInfo = null;
FolderInfo parentFolder = _personalStorage.RootFolder;
for (int i = 0; i < folders.Length; i++)
{
string fldName = folders[i];

var existsFolder = parentFolder.GetSubFolder(fldName);
if (existsFolder == null)
{
FolderInfo folderInfo = null;
string key = StandardIpmFolders.Keys.FirstOrDefault(x => string.Compare(x, fldName, StringComparison.OrdinalIgnoreCase) == 0);
if (!string.IsNullOrEmpty(key) && currentFolder == _personalStorage.RootFolder)
{
folderInfo = _personalStorage.CreatePredefinedFolder(fldName, StandardIpmFolders[key]);
}
else if (currentFolder != null)
{
folderInfo = currentFolder.AddSubFolder(fldName);
}
parentFolder = folderInfo;
}
else
{
parentFolder = existsFolder;
}
if (i == folders.Length - 1 && folderInfo == null)
{
folderInfo = parentFolder;
}
}
IEnumerable mapiMessages = mapiMessageItems.Select(i => i.Message).ToList();
try
{
folderInfo.AddMessages(mapiMessages);
return mapiMessageItems;
}
catch (Exception ex)
{
Logger.Error("Failed to add multiple items to PST! Exception: " + ex);
throw;
}
}



//-----------------Class MapiMessageItem has the following public properties---------------------//

public class MapiMessageItem : Item
{
///
/// Message content
///
public MapiMessage Message { get; set; }

///
/// Used for Envelope reconstructor and verification (only P2 should be verified)
///
public MapiMessage P2 { get; set; }
}



The created PST file can be opened in Outlook 2010/2013/2016 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”:

Version 15.0.4667.1000


**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

**Store created by build: (not available)

!!Search folder (nid=EC1) missing update queue

!!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 200064, row doesn’t match sub-object:
irow = 0, RowID = 8045

!!Contents Table for 8022, row doesn’t match sub-object:
irow = 2, RowID = 200064

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

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

!!Contents Table for 8022, row doesn’t match sub-object:
irow = 1, RowID = 200044

**Attempting to locate any orphaned folders/messages

**Performing final HMP validation

**Attempting to check top-level objects for consistency

??Deleting SDO

**Updating folder hierarchy


We are sending these PST files to another vendor for ingestion, and their ingestion tool is failing to ingest most of these files. Our project is in a seriously bad situation, so i request that this be prioritized and resolved as quickly as possible.

We have been able to reproduce this issue with the last three releases of Aspose.Email, including 6.2.

Please advise.


Hi Sevag,

We are sorry for the inconvenience you are facing.

This behavior of the API is already known to us and we are investigating it at our end under issue id: EMAILNET-35102. I have linked this thread to the logged ticket so that as soon as we have some update available about it, we’ll notify you here.

Meanwhile, I request you to please share your sample data (message files) that you are using to generating such a PST file. We use this to increase the size of our test pool data so that the issue be investigated in more details. We appreciate your cooperation in this regard.

Thank you, I have attached the emails we used to this post.

Hi Sevag,

Thank you for sharing the sample files. We have shared these with our Product team via the logged ticket and will update you here once there is some information available in this regard.

The issues you have found earlier (filed as EMAILNET-35102) 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