Search code examples
outlookoutlook-addinnetoffice

Outlook AddIn (NetOffice) - Context Menu


I'm using NetOffice developing an MS Outlook AddIn, and I want to add a custom context menu item in the calendar, to allow users add a new custom appointment for the selected time range.

So as written in this article I define my additional item in the RibbonUI.xml following way:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoadRibonUI">
  <ribbon>
    <tabs>
      <tab idMso="TabAppointment">
        <group id="Group0" label="Addin" insertBeforeMso="GroupShow">
          <button id="convertButton" label="Convert" getImage="ConvertImage" size="large" onAction="ConvertButton_Click" />
        </group>
      </tab>
      <tab idMso="TabCalendar">
        <group id="Group1" label="Addin" insertBeforeMso="GroupGoto">
          <button id="aboutButton" label="New Custom Meeting" getImage="GetNewImage" size="large" onAction="NewMeetingButton_Click" />
          <dialogBoxLauncher>
            <button id="settingsButton" screentip="Addin Settings" onAction="SettingsButton_Click"/>
          </dialogBoxLauncher>
        </group>
      </tab>
    </tabs>
  </ribbon>
  <contextMenus>    
      <contextMenu idMso="ContextMenuCalendarView">
          <button id="MyContextMenuCalendarView" 
              label="ContextMenuCalendarView" 
              onAction="OnMyButtonClick"/>
      </contextMenu>  
  </contextMenus>
</customUI>

But as soon as I add the <contextMenus> node, the xml isn't working anymore, not the add in doesn't add any context menu, but it also doesn't add any buttons anymore - whereas the buttons are added when the <contextMenus> node is not defined. Any tips how to debug this issue?

EDIT:

thanks to the tip from Dmitry I found the issue the xmlns namespace was an old one, so instead of:

xmlns="http://schemas.microsoft.com/office/2006/01/customui" 

it should be:

xmlns="http://schemas.microsoft.com/office/2009/07/customui"

Solution

  • I can't see anything wrong off the top of my head, but enable the dev mode in Outlook - this way Outlook will report all problems in your XML. Click File | Options | Advanced | Developers | Show add-in user interface errors.