• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2279
  • Last Modified:

Get outlook 2010 mailitem from ribbon-button-click in vb.net

Dear all,

I created an outlook addin with a ribbon. I use the ribbon type "Microsoft.Outlook.Mail.Read".

I put a button with the name "cmdCustomerFile" on the ribbon:

    Private Sub cmdCustomerFile_Click(sender As System.Object, e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles cmdCustomerFile.Click

    End Sub

Open in new window

The ribbon appers on evey open mail. I would like to read some information out of the mail if I click my button. How can I get the mailitem for my actual mail in the click function?
1 Solution
I think you would reference the application.activeexplorer.
DatenkulturAuthor Commented:
I used the following source:

Dim objApplication As Outlook.Application = Globals.ThisAddIn.Application
Dim objInspector As Outlook.Inspector = objApplication.ActiveInspector()
Dim objMailItem As Outlook.MailItem = CType(objInspector.CurrentItem, Outlook.MailItem)

Open in new window


Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now