none
Need to know contextMenu idMso for Contacts RRS feed

  • Question

  • How can i find contextMenu idMso for Contacts. Basically need to create a context menu option when right clicking on a contact card. Thanks

    Exchange/Outlook 2010

    Saturday, November 19, 2011 5:31 AM

Answers

  • Hi,

    You can see the typename returned by Office.IRibbonControl using
    Microsoft.VisualBasic.Information.TypeName(ribbonCtrl.Context);
    If you are creating contextmenu for ContactItems inside Contect Folder, the type would be Selection and ribbonCtrl.Context would be the collection of Outlook.ContactItem.
    So you need to typeCast as follows:


    if(ribbonCtrl.Context is Outlook.Selection)

    {

     Outlook.Selection selection = ribbonCtrl.Context as Outlook.Selection;
     if (selection.Count == 1)

     {
       Outlook.ContactItem contact1 = selection[1] as Outlook.ContactItem;
      }

     }


    Thanks!

     

     

     

    • Marked as answer by Bruce Song Wednesday, November 23, 2011 1:29 AM
    Monday, November 21, 2011 9:14 PM
  • Thanks Pallav!  this was the solution indeed
    Tuesday, November 22, 2011 4:47 AM

All replies

  • Hi jvargh,

    The idMso is GoToContacts. You can determine the idMso for any Office 2010 application by clicking on File and selecting Options. In the Options dialog, select Customize Ribbon. Then, from the Choose commands from dropdown, select All Commands.

    Scroll down the list of commands until you find what you need. Hover over the command with your mouse. The tooltip includes where the command is located, followed by the idMso in parenthesis:

    Good luck!

    Anonymous9748

    Sunday, November 20, 2011 1:47 AM
  • Just to be clear i'm trying to get the control from right clicking a contact card in Contacts. Do see the event on selecting my custom 'Dial' control come into the getContent callback but am not able to cast IRibbon object to any known type IMsoContactCard or otherwise. Any thoughts on what type to cast the IRibbon object to would be appreciated. thanks

     

    Sunday, November 20, 2011 6:22 AM
  • These articles (although in VB, not C#)

          http://www.accessribbon.de/en/index.php?Access_-_Ribbons:Callbacks:dynamicMenu_-_getContent

          http://blogs.office.com/b/microsoft-access/archive/2007/09/28/ribbon-customization-using-a-dynamicmenu-to-show-a-list-of-open-objects.aspx

    imply that there is a second Reference argument to the signature of your getContent function, AND it is an XML string, which clearly wouldn't be compatible with IMsoContactCard.  The second article above has a good example of building the XML menu.

    Anonymous9748

     

    Monday, November 21, 2011 3:26 AM
  • Hi,

    You can see the typename returned by Office.IRibbonControl using
    Microsoft.VisualBasic.Information.TypeName(ribbonCtrl.Context);
    If you are creating contextmenu for ContactItems inside Contect Folder, the type would be Selection and ribbonCtrl.Context would be the collection of Outlook.ContactItem.
    So you need to typeCast as follows:


    if(ribbonCtrl.Context is Outlook.Selection)

    {

     Outlook.Selection selection = ribbonCtrl.Context as Outlook.Selection;
     if (selection.Count == 1)

     {
       Outlook.ContactItem contact1 = selection[1] as Outlook.ContactItem;
      }

     }


    Thanks!

     

     

     

    • Marked as answer by Bruce Song Wednesday, November 23, 2011 1:29 AM
    Monday, November 21, 2011 9:14 PM
  • Thanks Pallav!  this was the solution indeed
    Tuesday, November 22, 2011 4:47 AM