Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6127619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:31:55+00:00 2026-05-23T16:31:55+00:00

EDIT: The posters answer is correct except for it should read xmlns=http://schemas.microsoft.com/office/2009/07/customui for the

  • 0

EDIT: The posters answer is correct except for it should read xmlns=”http://schemas.microsoft.com/office/2009/07/customui” for the include. As a side effect the ribbon and context menu defined in an XML file will not work in Office 2007. If you need to add a context menu in 2007, use the now deprecated, and a context menu within the Outlook 2007 message window is NOT POSSIBLE.

this.Application.ItemContextMenuDisplay += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(Application_ItemContextMenuDisplay);

I’ve created both a Ribbon and a Context menu, but I do not know how to deploy both of them at the same time.

My Ribbon XML looks something like this:

<?xml version="1.0" encoding="UTF-8"?>

<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">

<ribbon>

<tabs>

  <tab id="testTab" label="Test Label">

    <group id="testGroup" label="test">

      <button id="testButton" onAction="testAction" label="Test" size="large" 

          getImage ="GetCustomImage" screentip="Test Ribbon Functionality."/>         

    </group>      

  </tab>

 </tabs>

</ribbon>

</customUI>

Ribbon.cs has

public string GetCustomUI(string ribbonID)

{

  String ui = null;

  // Examine the ribbonID to see if the current item

  // is a Mail inspector.

  if (ribbonID == "Microsoft.Outlook.Mail.Read" ||

    ribbonID == "Microsoft.Outlook.Mail.Compose")

  {

    // Retrieve the customized Ribbon XML.

    ui = GetResourceText("WDCrypt2.Ribbon.xml") ;



  }

  return ui;

}

ContextMenu XML looks like (from a tutorial)

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

 <contextMenus>

  <contextMenu idMso="ContextMenuText">

   <button idMso="FontDialog" visible="false" />

   <toggleButton id="MyToggle" label="My Toggle Button" />

   <button id="MyButton" label="My Button" insertBeforeMso="HyperlinkInsert" onAction="GetButtonID" />

   <menuSeparator id="MySeparator" />

   <menu id="MySubMenu" label="My Submenu" >

    <button id="MyButton2" label="Button on submenu" />

   </menu>

   <gallery id="galleryOne" label="My Gallery">

    <item id="item1" imageMso="HappyFace" />

    <item id="item2" imageMso="HappyFace" />

    <item id="item3" imageMso="HappyFace" />

    <item id="item4" imageMso="HappyFace" />

   </gallery>

   <dynamicMenu id="MyDynamicMenu" label= "My Dynamic Menu" getContent="GetMyContent" />

  </contextMenu>

 </contextMenus>

</customUI>

With its cs file which looks like:

private Office.IRibbonUI ribbon;

public Ribbon2()
{
}

#region IRibbonExtensibility Members

public string GetCustomUI(string ribbonID)
{
  return GetResourceText("WDCrypt2.Ribbon2.xml");
}

The problem is to use either in my Addin Class I must:

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{

  return new Ribbon();

}

OR

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{

  return new Ribbon2(); //The Context Menu

}

But I cannot do both. How do I get both the context menu and the ribbon at the same time?

Edit: I would also like to refrain from using Application.ItemContextMenuDisplay, as this is officially deprecated by the API.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:31:55+00:00Added an answer on May 23, 2026 at 4:31 pm

    You need to combine the two ribbon XML files, then have a single callback file:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
    <ribbon>
    <tabs>
      <tab id="testTab" label="Test Label">
        <group id="testGroup" label="test">
          <button id="testButton" onAction="testAction" label="Test" size="large" 
              getImage ="GetCustomImage" screentip="Test Ribbon Functionality."/>         
        </group>      
      </tab>
     </tabs>
    </ribbon>
    <contextMenus>
      <contextMenu idMso="ContextMenuText">
       <button idMso="FontDialog" visible="false" />
       <toggleButton id="MyToggle" label="My Toggle Button" />
       <button id="MyButton" label="My Button" insertBeforeMso="HyperlinkInsert" onAction="GetButtonID" />
       <menuSeparator id="MySeparator" />
       <menu id="MySubMenu" label="My Submenu" >
        <button id="MyButton2" label="Button on submenu" />
       </menu>
       <gallery id="galleryOne" label="My Gallery">
        <item id="item1" imageMso="HappyFace" />
        <item id="item2" imageMso="HappyFace" />
        <item id="item3" imageMso="HappyFace" />
        <item id="item4" imageMso="HappyFace" />
       </gallery>
       <dynamicMenu id="MyDynamicMenu" label= "My Dynamic Menu" getContent="GetMyContent" />
      </contextMenu>
     </contextMenus>
    </customUI>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

XAML <Window x:Class=WpfApplication1.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <Grid> <DataGrid Height=117 HorizontalAlignment=Left Margin=43,12,0,0 Name=dataGrid1
Edit: From another question I provided an answer that has links to a lot
Edit : Solved, there was a trigger with a loop on the table (read
Edit: I have solved this by myself. See my answer below I have set
I need to do this: I have an old URL: http://www.mysite.com/dev-site/some-content-part-here That I want
Edit: Building off of aL3xa's answer below, I've modified his syntax below. Not perfect,
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: This question is more about language engineering than C++ itself. I used C++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.