Get outlook 2010 mailitem from ribbon-button-click in

Posted on 2012-08-13
Last Modified: 2012-08-13
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?
Question by:Datenkultur
    LVL 83

    Accepted Solution

    I think you would reference the application.activeexplorer.

    Author Comment

    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

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    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 …

    745 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

    18 Experts available now in Live!

    Get 1:1 Help Now