none
IRibbonExtensibility->GetCustomUI calling from a class other than Connect.cs RRS feed

  • Question

  • I am using Vs2010 -> Extensibility->Shared Add-in

    Connect.cs file

    public class Connect : Object, Extensibility.IDTExtensibility2, IRibbonExtensibility 
    {
          public string GetCustomUI(string RibbonID) 
          { 
              return MyResources.customUI; 
          }
    }

    The Ribbons gets created using this above code.

    I have Class customRibbons.cs

    public class Create_Custom_Ribbons : IRibbonExtensibility
    {
        Outlook.Application applicationObject;
        public Create_Custom_Ribbons(Outlook.Application application)
        {
            try
            {                               
                applicationObject = application;
                GetCustomUI("");
            }
            catch(Exception ex)
            {
                MessageBox.Show(""+ex.StackTrace);
            }
        }
        public string GetCustomUI(string RibbonID)
        {
            return MyResource.customUI;
        }
    }

    and on Connect.cs

    public void OnStartupComplete(ref System.Array custom)
    {
            try
            {
                customRibbons.Create_Custom_Ribbons cu = new 
                    customRibbons.Create_Custom_Ribbons(applicationObject);
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.StackTrace);
            }
    }

    But the Ribbons is not getting created.Please can anyone tell me what am i doing wrong or any other way to achieve this.I am not able to understand y it is not getting created.

    Saturday, April 6, 2013 11:52 AM

Answers

All replies