Click here to Skip to main content
14,869,914 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi friends,

I am developing Outlook 2013 Addin. I am using a ribbon control to show a Context Menu for the Contact Items. Everything else is working. But Menu doesnt appear.... Please Help...
Here is the Code for Ribbon....

XML
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"  önLoad="Ribbon_Load">
  <contextMenus>
    <contextMenu idMso="ContextMenuContactItem">
      <menuSeparator id="mniMailItemMenuSeparator" />
      <button id="customButton"
              label="Call Using FPHone"   insertBeforeQ="Copy"
              getImage="LoadCustomImage"
               önAction="OnMyButtonClick" />

    </contextMenu>

  </contextMenus>

</customUI>



C#
public void OnMyButtonClick(Office.IRibbonControl control)
       {


           if (control.Context is Outlook.Selection)
           {

               Outlook.Selection sel = control.Context as Outlook.Selection;
               Outlook.ContactItem cnt = sel[1];
               if (cnt != null && cnt.BusinessTelephoneNumber != null)
               {
                   string cmdparam = "function=call;number=" + cnt.BusinessTelephoneNumber.Replace(";", "").Replace(" ", "") + ";name=" + ((cnt.FileAs != null) ? cnt.FileAs.Replace(";", "").Replace(" ", "") : "Name Not Available");

                   try
                   {

                       string s = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                       if (System.IO.Directory.Exists(s + "\\FPHoneData") && File.Exists(s + "\\FPHoneData\\fcon.dat"))
                       {

                           string file_name = System.IO.File.ReadAllText(s + "\\FPHoneData\\fcon.dat");
                           if (File.Exists(file_name))
                               System.Diagnostics.Process.Start(file_name, cmdparam);
                           else
                               System.Windows.Forms.MessageBox.Show("Application File Cannot be Found!\nPlease Reinstall the Application", "FPHone", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);


                       }
                   }
                   catch
                   {
                   }

               }
               else
               {
                   System.Windows.Forms.MessageBox.Show("Business Telephone Number Not Found!");
               }

           }
       }
Posted
Updated 4-Aug-13 2:01am
v2
Comments
Joezer BH 4-Aug-13 7:43am
   
"... is not working" is quite a bad title, try to use the title to explain the major issue in one line.
Yesudasan Moses 4-Aug-13 8:01am
   
ok i did it.... But not yet a solution....

1 solution

I got it work at last....
I needed to override this Methode in ThisAddin.cs

C#
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
    {
        return new Ribbon1();
    }


Thanks Everybody.....
   
Comments
SaeedGorbani 30-Jun-15 18:16pm
   
I am doing the same thing but have been able to make it work. when I go to People and right click on business cards, there is no menu item. Please help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900