Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: MSG can’t be opened by Outlook 2010? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 21 July 2010 at 8:31pm | IP Logged Quote softwareguy

This is a follow up to a previous post that indicated there may be some issue with opening a message extracted from a PST and saved to disk using the MailBee.NET library.

Here is the code I'm using

    Private Sub SaveMessage()
        Dim fileName As String = "c:\test.msg"
        Dim itemCount As Integer
        Dim reader As PstReader = New PstReader("c:\test.pst")
        Dim folders As PstFolderCollection = reader.GetPstRootFolders(True)
        For Each folder As PstFolder In folders
             If folder.ShortName = "Inbox" Then
                itemCount = folder.Items.Count
                IO.File.Delete(fileName)
                Dim item As PstMessage = folder.Items(0)
                Dim msg As MailMessage = item.GetAsMailMessage
                msg.SaveMessage(fileName)
                Exit For
             End If
        Next
    End Sub

Is there anything wrong with the above code? It creates the msg file successfully, but when trying to open it in Outlook 2010, it gives the following error:

"Cannot start Microsoft Outlook. Cannot open file: C:\test.msg. The file may not exist, you may not have permission to open it, or it may be open in another program. Right-click the folder that contains the file, and then click Properties to check your permissions for the folder."

Well, I have permission to the folder because I'm able to create/open/delete other files in that same folder. Using a competing product I can extract and save the very same message file to that same folder and open it successfully in Outlook.
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 22 July 2010 at 1:03am | IP Logged Quote Igor

The code itself looks good, but it creates EML (RFC822) file, not Outlook MSG. Even though the extension is .msg, it's still .eml in fact. If you need to create MSG file, you might want to use this method instead of SaveMessage call.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
softwareguy
Newbie
Newbie


Joined: 17 July 2010
Location: United States
Online Status: Offline
Posts: 22
Posted: 22 July 2010 at 7:57am | IP Logged Quote softwareguy

Well then, that just might explain the problem I'm having! I'll give it a shot tonight. Thanks!
Back to Top View softwareguy's Profile Search for other posts by softwareguy
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide