Reputation: 81
I'm creating an Outlook add-in for 2007/2010 using Visual Studio 2010, VSTO 4.0
I have 3 Projects:
I'm just trying to load the correct version of the ribbon (DESIGNER) based on the version
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
majorVersion = Globals.ThisAddIn.Application.Version.Split(new char[] { '.' })[0];
if (majorVersion == 12) //Outlook 2007
{
Initialize2007UI();
}
else if (majorVersion >= 14) //Outlook 2010
{
Initialize2010UI();
}
}
How do I implement Initialize2007UI() and Initialize2010UI(); to load their respective Ribbon1.cs in the Explorer window and Ribbon2.cs in the Inspector window?
thanks!!!!
Hope I'm clear on what i"M asking :)
Upvotes: 3
Views: 1092
Reputation: 2748
probably this is what you are looking out for
protected override Office.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
majorVersion = Globals.ThisAddIn.Application.Version.Split(new char[] { '.' })[0];
if (majorVersion == 12) //Outlook 2007
{
return new Ribbon2007();
}
else if (majorVersion >= 14) //Outlook 2010
{
return new Ribbon2010();
}
}
[ComVisible(true)]
public class Ribbon2007: Office.IRibbonExtensibility
{
public string GetCustomUI(string ribbonID)
{
var ribbonXml = GetResourceText("Ribbon2007.xml");
XNamespace nameSpace = @"http://schemas.microsoft.com/office/2006/01/customui";
return ribbonXml;
}
}
[ComVisible(true)]
public class Ribbon2007: Office.IRibbonExtensibility
{
public string GetCustomUI(string ribbonID)
{
var ribbonXml = GetResourceText("Ribbon2010.xml");
XNamespace nameSpace = @"http://schemas.microsoft.com/office/2009/07/customui";
return ribbonXml;
}
}
Upvotes: 1