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

Posted on 2011-05-05
Medium Priority
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
  • 2

Expert Comment

by:Dav Gray
ID: 35700800

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

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

Hope that helps.

Accepted Solution

General_GSpot earned 0 total points
ID: 35722391
I used process.start(path.combine("outlook.exe", filename))

if anyone is interested

Author Closing Comment

ID: 35759450
Kept googling and eventually found the answer

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
I came across an unsolved Outlook issue and here is my solution.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

850 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