Link to home
Start Free TrialLog in
Avatar of General_GSpot
General_GSpot

asked on

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?
Avatar of Dav Gray
Dav Gray
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi,

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

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

Hope that helps.
ASKER CERTIFIED SOLUTION
Avatar of General_GSpot
General_GSpot

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of General_GSpot
General_GSpot

ASKER

Kept googling and eventually found the answer