Author |
|
bueroplan Newbie
Joined: 26 November 2010 Location: Germany
Online Status: Offline Posts: 2
|
Posted: 26 November 2010 at 5:18am | IP Logged
|
|
|
Hello Experts,
I would like to export all mails from a given PST file. For this I use the following code:
PstReader objPstReader = null;
PstFolderCollection objPstFolders = null;
MailMessage objMail = null;
string strPstName = Path.GetFileNameWithoutExtension(strPstFile).ToUpper();
string strFilename = String.Empty;
DateTime dtiReceived = DateTime.Now;
int i = 0;
objPstReader = new PstReader(strPstFile);
objPstFolders = objPstReader.GetPstRootFolders(true);
foreach (PstFolder objPstFolder in objPstFolders)
{
foreach (PstItem objItem in objPstFolder.Items)
{
if ((objItem != null) && (objItem.PstType == PstItemType.Message))
{
objMail = ((PstMessage)objItem).GetAsMailMessage(true);
if (objMail != null)
{
dtiReceived = objMail.DateReceived; // <<--- DateTime.MinValue ist returned
strFilename = Path.Combine(strExportDir, String.Format("{0}-{1:yyyyMMddHHmmss}{2:00000000}.EML", dtiReceived, strPstName, ++i));
objMail.SaveMessage(strFilename);
}
}
}
The export in EML-Files is actually correct, but the received-date of the e-mail is not read correctly. It is always DateTime.MinValue (01/01/01).
Can you help me?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 26 November 2010 at 12:59pm | IP Logged
|
|
|
Use HelpDesk to submit the .PST file in question.
Regards,
Alex
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 30 November 2010 at 12:52am | IP Logged
|
|
|
The file is received, developers will take a look.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 06 December 2010 at 7:31am | IP Logged
|
|
|
Try the updated version of MailBee.NET.dll and let us know if the update helps.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
bueroplan Newbie
Joined: 26 November 2010 Location: Germany
Online Status: Offline Posts: 2
|
Posted: 06 December 2010 at 11:44am | IP Logged
|
|
|
With the new version of MailBee.NET.dll 'DateReceived' is now displayed correctly.
Thank you very much.
Unfortunately, I realized that the property 'DateSent' show also always '01.01.0001'. Can you repair this property also?
Regards,
bueroplan
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 07 December 2010 at 5:19am | IP Logged
|
|
|
The thing is, regular EML message doesn't hold DateSent info, we've added it specifically for MSG-EML conversion.
You can try using the following code:
Code:
foreach (PstItem item in fItem.Items)
{
if (item != null && item.PstType == PstItemType.Message)
{
MailMessage mimeVersion = ((PstMessage)item).GetAsMailMessage();
Console.WriteLine(mimeVersion.Header s["X-Msg-ClientSubmitTime"]); |
|
|
There's no guarantee it will work as expected though. Alternately, you can try using Date property instead.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|