We have noticed that FolderInfo.AddMessage is sometimes throwing exceptions adding MapiMessages. The problem is very complicated though, because we can only reproduce it when extracting a MapiMessage from one PersonalStorage and adding it to another PersonalStorage.
I do not believe the problem is related to the specific message that the exception is thrown on. I believe the problem may be related to the original PersonalStorage, or the amount of messages transferred into the destination PersonalStorage.
If we extract the same exception MapiMessage (just one) from the source PersonalStorage and save it out to disk, the message looks fine in Outlook. If we then load that same message and add it to a destination PersonalStorage, everything works fine - no exceptions. However, if we do the same code but with all messages from the source PersonalStorage and simply transfer the MapiMessages from the source PersonalStorage to a new destination PersonalStorage, sometimes we get the exception below on many messages.
I can send you the source PST, but it is 1.7GB. What is the best way to send to you? Do you have an FTP or SkyDrive or YouSendIt link I can upload to?
Call stack:
----------------------
2012-09-27 11:46:13,709 [2088] ERROR wave.common.Library.MailHelper.MailStore - Error adding message ‘FW: From The Enron India Newsdesk - June 6th newsclips’ to MailStore ‘C:\Trident Projects\kaminski\output\kamainski.pst’.
System.ArgumentOutOfRangeException: Index out of range. This is a single-block configuration
Parameter name: 1
at .?.e(Int32 )
at .?.(? )
at .?.(? )
at ...?.MoveNext()
at ...??.MoveNext()
at .…ctor(? , )
at ..(? )
at ..??(MapiAttachmentCollection )
at ..?(MapiMessage , FolderInfo )
at ..AddMessage(FolderInfo , MapiMessage )
at Aspose.Email.Outlook.Pst.FolderInfo.AddMessage(MapiMessage message)
at wave.common.Library.MailHelper.MailStorePST.add(MapiMessage msg, String folderpath)
----------------------
2012-09-27 11:46:13,737 [2088] ERROR wave.common.Library.MailHelper.MailStore - Error adding message ‘Don’t miss IIR’s Private Placements Summit!’ to MailStore ‘C:\Trident Projects\kaminski\output\kamainski.pst’.
System.ArgumentOutOfRangeException: Index out of range. This is a single-block configuration
Parameter name: 1
at .?.e(Int32 )
at .?.(? )
at .?.(? )
at ...?.MoveNext()
at ...??.MoveNext()
at .…ctor(? , )
at ..(? )
at ..??(MapiAttachmentCollection )
at ..?(MapiMessage , FolderInfo )
at ..AddMessage(FolderInfo , MapiMessage )
at Aspose.Email.Outlook.Pst.FolderInfo.AddMessage(MapiMessage message)
at wave.common.Library.MailHelper.MailStorePST.add(MapiMessage msg, String folderpath)
----------------------
2012-09-27 11:46:14,307 [2088] ERROR wave.common.Library.MailHelper.MailStore - Error adding message ‘RE: Follow up’ to MailStore ‘C:\Trident Projects\kaminski\output\kamainski.pst’.
System.ArgumentOutOfRangeException: Index out of range. This is a single-block configuration
Parameter name: 1
at .?.e(Int32 )
at .?.(? )
at .?.(? )
at ...?.MoveNext()
at ...??.MoveNext()
at .…ctor(? , )
at ..(? )
at ..??(MapiAttachmentCollection )
at ..?(MapiMessage , FolderInfo )
at ..AddMessage(FolderInfo , MapiMessage )
at Aspose.Email.Outlook.Pst.FolderInfo.AddMessage(MapiMessage message)
at wave.common.Library.MailHelper.MailStorePST.add(MapiMessage msg, String folderpath)
----------------------
2012-09-27 11:46:15,737 [2088] ERROR wave.common.Library.MailHelper.MailStore - Error adding message ‘FW: D-G Energy Software Procurement’ to MailStore ‘C:\Trident Projects\kaminski\output\kamainski.pst’.
System.ArgumentOutOfRangeException: Index out of range. This is a single-block configuration
Parameter name: 1
at .?.e(Int32 )
at .?.(? )
at .?.(? )
at ...?.MoveNext()
at ...??.MoveNext()
at .…ctor(? , )
at ..(? )
at ..??(MapiAttachmentCollection )
at ..?(MapiMessage , FolderInfo )
at ..AddMessage(FolderInfo , MapiMessage )
at Aspose.Email.Outlook.Pst.FolderInfo.AddMessage(MapiMessage message)
at wave.common.Library.MailHelper.MailStorePST.add(MapiMessage msg, String folderpath)
----------------------
Please note that we are using the new Aspose.Email 2.2 as well (we discovered this same issue in 2.1 as well).
Hi,
Here is a link to download the source .pst:
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>http://www.yousendit.com/download/TEhYYUlyTERGOFJ3SGNUQw
Do not use the big green ‘Download’ button, just click on the link to the file. This data is not sensitive, it is publicly available ENRON data.
Please test with a loop that extracts each message from the source .pst and add it to a similarly named folder in the new destination .pst. You should see the exceptions we have posted above.
Hi,
{
try
{
Console.WriteLine(“Loading PST file…”);
// load the Outlook PST file
PersonalStorage pst = PersonalStorage.FromFile(“EMAIL_416186\CMI Inbox 1.pst”);
// get the Display Name of the PST file
Console.WriteLine(“Display Name: " + pst.DisplayName);
// get the folders and messages information
FolderInfo folderInfo = pst.RootFolder;
// call the recursive method to extract msg files from each folder
ExtractMsgFiles(folderInfo, pst);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private static void ExtractMsgFiles(FolderInfo folderInfo, PersonalStorage pst)
{
// display the folder name
Console.WriteLine(“Folder: " + folderInfo.DisplayName);
Console.WriteLine(”==================================”);
if (folderInfo.DisplayName == “MailsBox”)
{
// Create new PST
PersonalStorage DestPst = PersonalStorage.Create(“DestPST.pst”, FileFormatVersion.Unicode);
// Add new folder “Inbox”
DestPst.RootFolder.AddSubFolder(“MailsBox”);
//Get destination folder
FolderInfo DestFolderInfo = pst.RootFolder.GetSubFolder(“MailsBox”);
// loop through all the messages in this folder
MessageInfoCollection messageInfoCollection = folderInfo.GetContents();
foreach (MessageInfo messageInfo in messageInfoCollection)
{
// get the message in MapiMessage instance
MapiMessage message = pst.ExtractMessage(messageInfo);
// Add to destination folder
DestFolderInfo.AddMessage(message);
}
}
// call this method recursively for each subfolder
if (folderInfo.HasSubFolders == true)
{
foreach (FolderInfo subfolderInfo in folderInfo.GetSubFolders())
{
ExtractMsgFiles(subfolderInfo, pst);
}
}
}
Yes, as I said when I posted this thread, you should test with the source PST I provided.
Here is a new link (it will expire on Friday 10/12/2012):
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>http://www.yousendit.com/download/TEhYZm1jNDIwZ24wZXNUQw
Please download it and test with it.
Also, for the record, your code that you tested with will only extract messages from a folder called “MailsBox”. Even though you call the function recursively, it will only extract messages from folders named “MailsBox”. Just letting you know.
I have extended the expiration for a month.
In the future you guys should seriously consider setting up one of these free skydrive/cloud accounts to accommodate us, your clients. Most developers who are processing OST/PST files are dealing with very large files, as modern day mail store files get large rather quickly.
Hi,
The issues you have found earlier (filed as NETWORKNET-33490) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)