I created new outlook ribbon by ribbonXML
I want to show this Ribbon
1. in Appointment\Meeting window
2. in CalendarItems near 'Appointment' tab , when appointment is selected from the calendar view
I can display the two options but not together in one Ribbon.
"contextualTabs" - displays the tab in calendarItems,
"TabAddins" - displays the tab only in appointment\meeting window according to the C# code
I want this Ribbon will be displayed in both of these cases.How can I do it?
My Code:
<ribbon>
<tabs>
<tab idMso="TabAddIns" label="MyTab">
<group id="group1" label="save">
<button id="btnSaveAs" onAction="btnSaveAs_Click"
imageMso="FileSave"/>
</group>
</tab>
</tabs>
<contextualTabs>
<tabSet idMso="TabSetAppointment">
<tab id="TabAppointment" label="MyTab">
<group id="MyGroup" label="save">
<button id="btnSaveAppAs" onAction="btnSaveAs_Click" label="save"
imageMso="FileSave"/>
</group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
C#: (cause showing the ribbon only in appointment\meeting window)
public string GetCustomUI(string ribbonID)
{
if(ribbonID=="Microsoft.Outlook.Appointment")
return GetResourceText("OutlookAddIn.Ribbon.xml");
if (ribbonID == "Microsoft.Outlook.MeetingRequest")
return GetResourceText("OutlookAddIn.Ribbon.xml");
return null;
}
I found the solution.
I put the two options in two separate xml files and repaired getcustomUI
Ribbon.xml:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
<ribbon>
<tabs>
<tab idMso="TabAddIns" label="MyTab">
<group id="group1" label="save">
<button id="btnSaveAs" onAction="btnSaveAs_Click"
imageMso="FileSave"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
CalendarToolsRibbon.xml:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
<ribbon>
<contextualTabs>
<tabSet idMso="TabSetAppointment">
<tab id="TabAppointment" label="MyTab">
<group id="MyGroup" label="save">
<button id="btnSaveAppAs" onAction="btnSaveAs_Click" label="save"
imageMso="FileSave"/>
</group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
</customUI>
C#:
public string GetCustomUI(string ribbonID)
{
if (ribbonID == "Microsoft.Outlook.Appointment")
return GetResourceText("OutlookAddIn.Ribbon.xml");
if (ribbonID == "Microsoft.Outlook.MeetingRequest.Read")
return GetResourceText("OutlookAddIn.Ribbon.xml");
return GetResourceText("OutlookAddIn.CalendarToolsRibbon.xml");
}