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

Posted on 2011-05-05
Last Modified: 2012-05-11
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)
        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?
Question by:General_GSpot
    LVL 5

    Expert Comment


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

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

    Hope that helps.
    LVL 1

    Accepted Solution

    I used process.start(path.combine("outlook.exe", filename))

    if anyone is interested
    LVL 1

    Author Closing Comment

    Kept googling and eventually found the answer

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Find out how to use dynamic social media in email signatures with this top 10 DOs & DON’Ts.
    Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now