0

I have a created an outlook Add-Ins and its working as expected. The newly installed add-in is displayed at the Home tab of outlook. It is displayed as a new group.

I need my add-in to get displayed next to new item option present in outlook.

For better understanding please see the image. I need my add in exactlt at the yellow coloured position.

Code snippet

private void InitializeComponent() {
        this.tabCustomHome = this.Factory.CreateRibbonTab();
        this.group1 = this.Factory.CreateRibbonGroup();
        this.menuButton1 = this.Factory.CreateRibbonMenu();
        this.btnLogin = this.Factory.CreateRibbonButton();
        this.btnLogout = this.Factory.CreateRibbonButton();
        this.tabCustomHome.SuspendLayout();
        this.group1.SuspendLayout();
        this.SuspendLayout();
        // 
        // tabCustomHome
        // 
        this.tabCustomHome.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office;
        this.tabCustomHome.ControlId.OfficeId = "TabMail";
        this.tabCustomHome.Groups.Add(this.group1);
        this.tabCustomHome.Label = "TabMail";
        this.tabCustomHome.Name = "tabCustomHome";
        // 
        // group1
        // 
        this.group1.Items.Add(this.menuButton1);
        this.group1.Label = "Sample";
        this.group1.Name = "group1";
        // 
        // menuButton1
        // 
        this.menuButton1.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.menuButton1.Dynamic = true;
        this.menuButton1.Image = global::SHOutlookLogin.Properties.Resources.Sales;
        this.menuButton1.Label = " ";
        this.menuButton1.Name = "menuButton1";
        this.menuButton1.ShowImage = true;
        // 
        // btnLogin
        // 
        this.btnLogin.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.btnLogin.Label = "Login";
        this.btnLogin.Name = "btnLogin";
        this.btnLogin.ShowImage = true;
        this.btnLogin.Click += BtnLogin_Click;
        // 
        // btnLogout
        // 
        this.btnLogout.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.btnLogout.Label = "Logout";
        this.btnLogout.Name = "btnLogout";
        this.btnLogout.ShowImage = true;
        this.btnLogout.Click += BtnLogout_Click;
        // 
        // OutlookLoginRibbon
        // 
        this.Name = "OutlookLoginRibbon";
        this.RibbonType = "Microsoft.Outlook.Explorer";
        this.Tabs.Add(this.tabCustomHome);
        this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.OutlookLoginRibbon_Load);
        this.tabCustomHome.ResumeLayout(false);
        this.tabCustomHome.PerformLayout();
        this.group1.ResumeLayout(false);
        this.group1.PerformLayout();
        this.ResumeLayout(false);

    }



    #endregion

    internal Microsoft.Office.Tools.Ribbon.RibbonTab tabCustomHome;
    internal Microsoft.Office.Tools.Ribbon.RibbonGroup group1;
    internal Microsoft.Office.Tools.Ribbon.RibbonButton btnLogin;
    internal Microsoft.Office.Tools.Ribbon.RibbonButton btnLogout;
    internal Microsoft.Office.Tools.Ribbon.RibbonMenu menuButton1;

enter image description here

Mohanvel V
  • 768
  • 4
  • 17

1 Answers1

1

You need to use the following markup:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="ribbonLoaded_Callback">
  <ribbon startFromScratch="false">
    <tabs>
      <tab getVisible="getVisible_Callback" idMso="TabMail">
        <group getLabel="getLabel_Callback" getScreentip="getScreenTip_Callback" getVisible="getVisible_Callback" id="RibbonGroup_3b56363af4b447adb1126bb6791405c7" insertAfterMso="GroupMailNew">
           <button getDescription="getDescription_Callback" getEnabled="getEnabled_Callback" getKeytip="getKeytip_Callback" getLabel="getLabel_Callback" getScreentip="getScreenTip_Callback" getShowImage="getShowImage_Callback" getShowLabel="getShowLabel_Callback" getSize="getSize_Callback" getVisible="getVisible_Callback" id="RibbonButton_7f2ec50f5d65467fbcf3cadef7e8ab15" onAction="onActionCommon_Callback" />
        </group>
     </tab>
   </tabs>
  </ribbon>
</customUI>   

As a result, you should get the following picture in Outlook:

Outlook 2013 with a custom ribbon controls on a built-in tab

You may find the Walkthrough: Create a custom tab by using Ribbon XML article helpful.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45