Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to add Outlook toolbar under the subject line in C# add-in?

How to add Outlook toolbar under the subject line in C# add-in?

Scheduled Pinned Locked Moved C#
csharpquestionasp-netlinqcom
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Artem Moroz
    wrote on last edited by
    #1

    I need to write an Outlook 2003-2010 plugin using C# that adds two buttons to the Message Ribbon Bar (#1 on the picture) and a several buttons toolbar or a Form Region under the "Subject" line (#2 on the picture). See image here: http://i.piccy.info/i9/8ccdf69246fbcd9171d488747c6ea189/1398291704/206810/736482/editmessage.png[^] Currently I managed to add a button to the Ribbon toolbar, but it appears in the "Add-ins" Ribbon Bar. How do I add buttons to the "Message" Ribbon Bar? And how do I add the Toolbar #2 ? I currently have no clue about how to add it. Please help me! I now have the following code:

    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 SendLaterToolbar
    {
    public partial class ThisAddIn
    {
    Office.CommandBar newToolBar;
    Office.CommandBarButton firstButton;
    Office.CommandBarButton secondButton;
    Outlook.Explorers selectExplorers;
    Outlook.Inspectors inspectors;
    Office.CommandBarButton _objEmailToolBarButton;

        private void ThisAddIn\_Startup(object sender, System.EventArgs e)
        {
            selectExplorers = this.Application.Explorers;
            inspectors = this.Application.Inspectors;
            selectExplorers.NewExplorer += new Outlook.ExplorersEvents\_NewExplorerEventHandler(newExplorer\_Event);
            inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents\_NewInspectorEventHandler(AddToEmail);
            AddToolbar();
        }
    
        private void newExplorer\_Event(Outlook.Explorer new\_Explorer)
        {
            ((Outlook.\_Explorer)new\_Explorer).Activate();
            newToolBar = null;
            AddToolbar();
        }
    
        private void ThisAddIn\_Shutdown(object sender, System.EventArgs e)
        {
    
        }
    
        private void AddToolbar()
        {
    
            if (newToolBar == null)
            {
                Office.CommandBars cmdBars =
                    this.Application.ActiveExplorer().CommandBars;
                newToolBar = cmdBars.Add(
    
    L 1 Reply Last reply
    0
    • A Artem Moroz

      I need to write an Outlook 2003-2010 plugin using C# that adds two buttons to the Message Ribbon Bar (#1 on the picture) and a several buttons toolbar or a Form Region under the "Subject" line (#2 on the picture). See image here: http://i.piccy.info/i9/8ccdf69246fbcd9171d488747c6ea189/1398291704/206810/736482/editmessage.png[^] Currently I managed to add a button to the Ribbon toolbar, but it appears in the "Add-ins" Ribbon Bar. How do I add buttons to the "Message" Ribbon Bar? And how do I add the Toolbar #2 ? I currently have no clue about how to add it. Please help me! I now have the following code:

      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 SendLaterToolbar
      {
      public partial class ThisAddIn
      {
      Office.CommandBar newToolBar;
      Office.CommandBarButton firstButton;
      Office.CommandBarButton secondButton;
      Outlook.Explorers selectExplorers;
      Outlook.Inspectors inspectors;
      Office.CommandBarButton _objEmailToolBarButton;

          private void ThisAddIn\_Startup(object sender, System.EventArgs e)
          {
              selectExplorers = this.Application.Explorers;
              inspectors = this.Application.Inspectors;
              selectExplorers.NewExplorer += new Outlook.ExplorersEvents\_NewExplorerEventHandler(newExplorer\_Event);
              inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents\_NewInspectorEventHandler(AddToEmail);
              AddToolbar();
          }
      
          private void newExplorer\_Event(Outlook.Explorer new\_Explorer)
          {
              ((Outlook.\_Explorer)new\_Explorer).Activate();
              newToolBar = null;
              AddToolbar();
          }
      
          private void ThisAddIn\_Shutdown(object sender, System.EventArgs e)
          {
      
          }
      
          private void AddToolbar()
          {
      
              if (newToolBar == null)
              {
                  Office.CommandBars cmdBars =
                      this.Application.ActiveExplorer().CommandBars;
                  newToolBar = cmdBars.Add(
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      M A V wrote:

      Currently I managed to add a button to the Ribbon toolbar, but it appears in the "Add-ins" Ribbon Bar. How do I add buttons to the "Message" Ribbon Bar?

      First check here[^] whether that's a supported scenario.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      A 1 Reply Last reply
      0
      • L Lost User

        M A V wrote:

        Currently I managed to add a button to the Ribbon toolbar, but it appears in the "Add-ins" Ribbon Bar. How do I add buttons to the "Message" Ribbon Bar?

        First check here[^] whether that's a supported scenario.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        A Offline
        A Offline
        Artem Moroz
        wrote on last edited by
        #3

        I belive yes because I saw other plugins doing such integration.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups