none
Outlook 2013 Context Menu on Email Address RRS feed

  • Question

  • I would like to add a menu item to the context menu that appears when right clicking an email address in the reading pane. Is this possible?

     <contextMenu idMso="??">
          <button id="btnREAD_CreateEmailAssociation" onAction="HandleRibbonClicks" label="Associate with Entity" getImage="getRibbonImage" />
        </contextMenu>

    If so, how do I get the value of the email address so that I can pass it to "HandleRibbonClicks"? What is the Office.IRibbonControl passed?

    I've tried using ContextMenuContactCardRecipient and ContextMenuContactCardSender but the menu still won't show up.



    • Edited by macowl Wednesday, March 19, 2014 8:14 AM
    Wednesday, March 19, 2014 7:04 AM

Answers

  • Hello macowl,

    Please take a look at the How to: Customize the Ribbon UI by using a Managed COM Add-in article.

    As a rule, the following method is called by the host application:

    string IRibbonExtensibility.GetCustomUI(string RibbonID)
    {
    }

    You should get a separate call for the context menu. The string will contain Microsoft.Mso.IMLayerUI value. Only in that case you need to return the context menu related markup (I posted above, see my previous message).

    For example, when I start Outlook I get the first call with the Microsoft.Outlook.Explorer and then when I do right click on the e-mail address I receive the second request with the Microsoft.Mso.IMLayerUI value. So, you need to separate the Ribbon UI markup.

    Friday, March 21, 2014 12:27 PM

All replies

  • Hello,

    It looks like not because Office 2013 Help Files: Office Fluent User Interface Control Identifiers don't include such idMso value. Unfortunately not all context menus can be customized in Outlook.

    Wednesday, March 19, 2014 8:24 AM
  • As I said, I found ContextMenuContactCardRecipient.

    In the documentation it shows an image of the menu I want to modify (the one which pops on email address). But I can't seem to get it to work.

    If you go to http://msdn.microsoft.com/en-us/library/ee692172%28v=office.14%29.aspx and search for ContextMenuContactCardRecipient

    Wednesday, March 19, 2014 8:49 AM
  • You are right, that IDs work like a charm on my PC with Outlook 2013 SP1 installed. Here is how it looks like:

    I used the following markup to get it working:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="ribbonLoaded_" loadImage="getImages">
      <contextMenus>
        <contextMenu idMso="ContextMenuContactCardRecipient">
          <button getEnabled="getEnabled" getLabel="getLabel" getVisible="getVisible" id="MyRibbonButton" onAction="onClick" />
        </contextMenu>
      </contextMenus>
    </customUI>

    Wednesday, March 19, 2014 11:16 AM
  • Interesting. And this is on right clicking an email address in the Reading Pane? or Explorer pane?
     I have other context menus working, it's just this one I can't get to work.
    • Edited by macowl Thursday, March 20, 2014 1:28 AM
    Thursday, March 20, 2014 1:27 AM
  • It is for Reading pane. What code and markup do you use?

    Thursday, March 20, 2014 6:03 AM
  • So the first two context menus here work fine. But the "ContextMenuContactCardRecipient" one won't show up.

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab id="TabReader" label="HPLAN">
            <group id="rgrpEntity" getLabel="UpdateEntityLabel">
              <button id="btnREAD_EntityChange" onAction="HandleRibbonClicks" label="Change Entity" size="large" getImage="getRibbonImage" />
              <button id="btnREAD_EntityClear" onAction="HandleRibbonClicks" label="Clear Entity" size="large" getImage="getRibbonImage" getEnabled="IsEntityEnabled" />
              <button id="btnREAD_AttachToTask" onAction="HandleRibbonClicks" label="Attach To HPLAN Task" size="large" getImage="getRibbonImage" />
              <button id="btnREAD_OpenEntityInHPLAN" onAction="HandleRibbonClicks" label="Open Entity in HPLAN" size="large" getImage="getRibbonImage" />
              <button id="btnREAD_AssociateSender" onAction="HandleRibbonClicks" label="Associate Sender with Entity" size="large" getImage="getRibbonImage" />
            </group>
            <group id="Group1" label="Templates">
              <button id="btnREAD_SaveAsTemplate" onAction="HandleRibbonClicks" label="Save as Template" size="large" getImage="getRibbonImage" />
            </group>
            <group id="Group3" label="History">
              <button id="btnREAD_Document" onAction="HandleRibbonClicks" supertip="Has this email been filed?" label="HPLAN Filing" size="large" getImage="getRibbonImage" />
            </group>
          </tab>
        </tabs>
      </ribbon>
      <contextMenus>
        <contextMenu idMso="ContextMenuAttachments">
          <button id="btnREAD_SendToMyQ" onAction="HandleRibbonClicks" label="Send to my Queue" getImage="getRibbonImage" />
          <button id="btnREAD_SendToDMS" onAction="HandleRibbonClicks" label="Send To HPLAN DMS" getImage="getRibbonImage" />
        </contextMenu>
        <contextMenu idMso="ContextMenuContactCardRecipient">
          <button id="btnREAD_CreateEmailAssociation" onAction="HandleRibbonClicks" label="Associate Email with Entity" getImage="getRibbonImage" />
        </contextMenu>
      </contextMenus>
    </customUI>

    Friday, March 21, 2014 7:28 AM
  • Hello macowl,

    Please take a look at the How to: Customize the Ribbon UI by using a Managed COM Add-in article.

    As a rule, the following method is called by the host application:

    string IRibbonExtensibility.GetCustomUI(string RibbonID)
    {
    }

    You should get a separate call for the context menu. The string will contain Microsoft.Mso.IMLayerUI value. Only in that case you need to return the context menu related markup (I posted above, see my previous message).

    For example, when I start Outlook I get the first call with the Microsoft.Outlook.Explorer and then when I do right click on the e-mail address I receive the second request with the Microsoft.Mso.IMLayerUI value. So, you need to separate the Ribbon UI markup.

    Friday, March 21, 2014 12:27 PM