Search code examples
c#outlook-addinribbonextensibilitycomaddin

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


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.


Solution

  • See my reply at the Office Dev group: http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/394ac918-f32f-4c7b-9dee-a6d45f1bdf46