Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 524747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:36:00+00:00 2026-05-13T08:36:00+00:00

I am programmer rookie, and I have to create outlook 2007 add-in. I should

  • 0

I am programmer rookie, and I have to create outlook 2007 add-in. I should create a button on the ribbon or taskbar but on the window for the single mail from the inbox. You know, when you double click on mail in inbox, the new window appears. And in that window I need a button which opens a new form with some treeview. Main problem for me is how to create that button. This is all new for me so I’ll be very thankful for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:36:01+00:00Added an answer on May 13, 2026 at 8:36 am

    OK, I’ve done some research and this code below kinda works 🙂 But I’ll be very grateful if someone experienced could see this and tells me is it OK and what and how I could change it. This is just beginning of the bigger project.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using Outlook = Microsoft.Office.Interop.Outlook;
    using Office = Microsoft.Office.Core;
    using System.Windows.Forms;
    
    namespace OutlookAddInMishko
    {
        public partial class ThisAddIn
        {
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
    
                Inspectors = this.Application.Inspectors;
                Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            }
    
            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
            }
    
            #region VSTO generated code
    
    
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }
    
            #endregion
    
    
              private Office.CommandBarButton buttonOne;
    
            private Outlook.Inspectors Inspectors;
            public static Microsoft.Office.Interop.Outlook.Inspector InsMail;
    
            void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
            {
                Outlook.MailItem tmpMailItem = (Outlook.MailItem)Inspector.CurrentItem;
    
                if (Inspector.CurrentItem is Outlook.MailItem)
                {
                    tmpMailItem = (Outlook.MailItem)Inspector.CurrentItem;
                    bool exists = false;
                    foreach (Office.CommandBar cmd in Inspector.CommandBars)
                    {
                        if (cmd.Name == "EAD")
                        {
                            //exists = true;
                            cmd.Delete();
                        }
                    }
    
                    Office.CommandBar newMenuBar = Inspector.CommandBars.Add("EAD", Office.MsoBarPosition.msoBarTop, false, true);
                    buttonOne = (Office.CommandBarButton)newMenuBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, missing, missing, true);
    
                    if (!exists)
                    {
                        buttonOne.Caption = "Scan this mail";
                        buttonOne.Style = Office.MsoButtonStyle.msoButtonCaption;
                        buttonOne.FaceId = 1983;
    
                        //Register send event handler
                        buttonOne.Click += new Office._CommandBarButtonEvents_ClickEventHandler(buttonOne_Click);
                        newMenuBar.Visible = true;
                    }
                }
    
    
            }
    
    
            private void buttonOne_Click(Office.CommandBarButton ctrl, ref bool cancel)
            {
                ProcessMessages();
            }
    
            private Form1 form1 = null;
    
            private void ProcessMessages()
            {
                if (form1 == null)
                {
                    form1 = new Form1(this.Application);
                }
                form1.ShowDialog();
            }
    
    
        }
    }
    
    
    namespace OutlookAddInMishko
    {
        public partial class Form1 : Form
        {
            protected Outlook.Application App;
            public Form1()
            {
                InitializeComponent();
            }
            public Form1(Outlook.Application _app)
            {
                App = _app;
                InitializeComponent();
            }
    
            private void Form1_Shown(object sender, EventArgs e)
            {
                label1.Text = "Total number of mails in inbox: " + App.ActiveExplorer().CurrentFolder.Items.Count.ToString();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                Outlook.MailItem item = (Outlook.MailItem)App.ActiveInspector().CurrentItem;
                textBox1.Text += "From:    " + item.SenderName + "\r\n\n";
                textBox1.Text += "Subject: " + item.Subject + "\r\n\n";
                textBox1.Text += "Body: \r\n\n" + item.Body + "\r\n";
                textBox1.Text += "Mail contains:    " + item.Attachments.Count + " attachment(s).\r\n\n";
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scala programmer should have known that this sort of writing : class Person{ var
i have a problem. i am a rookie programmer, about a year ago i
New programmer- I have created a function to add a user to a database.
I'm a fairly rookie C++ programmer, but in my limited experience with the language,
Rookie C++ Programmer here again I'm using VC++ VS2008 and making an attempt at
A programmer on your team is great at maintaining the old legacy system. But
I'm a java programmer switching over to C++. I have a list of data
I'm not a programmer, but I've done all the customizations for my web shop
i am a newbie programmer in ASP.NET. So My database have two tables: UserTypes
As a PHP programmer new to Perl working through 'Programming Perl', I have come

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.