Maybe too late but can be helpful for others!
XML
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<contextMenus>
<contextMenu idMso="ContextMenuContactCardRecipient">
<button id="myMenuBtn"
label="get mail email"
onAction="lookForMe"
visible="true"/>
</contextMenu>
</contextMenus>
</customUI>
C#
public void lookForMe(IRibbonControl control)
{
Office.IMsoContactCard card = control.Context as Office.IMsoContactCard;
string email = GetSmtpAddress(card);
if (email != null)
{
System.Diagnostics.Process.Start("https://org.ad.com/" + email);
}
}
private string GetSmtpAddress(Office.IMsoContactCard card)
{
if (card.AddressType == Office.MsoContactCardAddressType.msoContactCardAddressTypeOutlook)
{
Microsoft.Office.Interop.Outlook.Application host = Globals.ThisAddIn.Application;
Microsoft.Office.Interop.Outlook.AddressEntry ae = host.Session.GetAddressEntryFromID(card.Address);
if ((ae.AddressEntryUserType == Microsoft.Office.Interop.Outlook.OlAddressEntryUserType.olExchangeUserAddressEntry
|| ae.AddressEntryUserType == Microsoft.Office.Interop.Outlook.OlAddressEntryUserType.olExchangeRemoteUserAddressEntry))
{
Microsoft.Office.Interop.Outlook.ExchangeUser ex = ae.GetExchangeUser();
return ex.PrimarySmtpAddress;
}
else
throw new System.Exception("unvalid address entry not found.");
}
else
return card.Address;
}