opening an outlook .msg from a directory store, vb.

we have a program called MessageSave which lets users store sent emails in a folder for archiving. The users can then see the messages using a VB program, and even read the contents from some textboxes. I've made it so they can print, but the users would actually like to open up those messages in an Outlook message form because the printing is better, and they can use the calendar as well.

I've tried Process.Start("outlook.exe", ?) but I'm not sure how to make outlook open that email directly.

Here is the code I had so far.

Private Sub btnOutlook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutlook.Click
        Dim folder As String = CStr(TreeView1.SelectedNode.Tag)
        Dim file As String = folder.ToString
        If ListView1.SelectedItems.Count > 0 Then
            Dim lvO As ListViewItem = ListView1.SelectedItems(0)
            Dim filename As String = file & "\" & lvO.Text
            Dim msg As MapiMessage = MapiMessage.FromFile(filename)
            Process.Start("outlook.exe")
        End If
    End Sub

Open in new window



I guess I'm not sure how to pass the .msg as an argument to outlook.

Is Process.start even the right thing to use here?
LVL 1
General_GSpotAsked:
Who is Participating?
 
General_GSpotConnect With a Mentor Author Commented:
I used process.start(path.combine("outlook.exe", filename))

if anyone is interested
0
 
Dav GrayIT ManagerCommented:
Hi,

You could pass the /f switch as part of your parameter so:

Process.Start("outlook.exe /f <msgfilename or variable>")

Hope that helps.
0
 
General_GSpotAuthor Commented:
Kept googling and eventually found the answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.