Hi,
I know this message has been posted a couple of times previously by other people; however, those posts relate to the Java library and don’t appear to have been fixed in the .NET library. I’m using version 19.4 which is the latest at the time of writing.
I’m attempting to import MSG files into a PST. The MSG files total around 1.5GB but the resulting PST is 12GB. Some size differences are to be expected, but this is quite significant. Furthermore, the PST can’t be opened in Outlook (“Failed to create all properties in this location”) and instead I need to run it through ScanPST first which identifies 3,000 issues in a file containing 20,000 items. Once ScanPST is run I can open the PST and everything appears fine (although the file is still extremely large).
I am unable to provide copies of the MSG/PST files, but I’ve included the part of the code relating to importing the MSG files into the PST below.
private Int32 Import(String inputPath, String outputPath)
{
using (PersonalStorage outputStorage = PersonalStorage.Create(outputPath, FileFormatVersion.Unicode))
{
return Import(inputPath, outputStorage.RootFolder);
}
}
private Int32 Import(String inputPath, FolderInfo outputFolder)
{
Int32 errors = 0;
foreach (String file in Directory.GetFiles(inputPath, "*.msg", SearchOption.TopDirectoryOnly))
{
try
{
outputFolder.AddMessage(MapiMessage.FromFile(file));
}
catch
{
++errors;
}
}
foreach (String directory in Directory.GetDirectories(inputPath, "*", SearchOption.TopDirectoryOnly))
{
String name = new DirectoryInfo(directory).Name;
FolderInfo outputSubFolder = outputFolder.GetSubFolder(name);
if (outputSubFolder == null)
outputSubFolder = outputFolder.AddSubFolder(name);
errors += Import(directory, outputSubFolder);
}
return errors;
}
There are only 6 errors out of the 20,000 MSG files, which are occurring due to the filenames being too long, so they are unrelated to Aspose.Email. Apart from those six, the rest of the messages appear fine in the resulting PST (once run through ScanPST).
Any advice would be greatly appreciated.
Thanks.