Click here to Skip to main content
14,869,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I am developing an Outlook Add In project for just to show a Menu to the Contact Items. But Nothing is working.. Can anybody Please give me the code to do so...

Current Code is like this.... It works best for Outlook 2007, But not for 2013...

public partial class ThisAddIn
{

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

var inspectors = this.Application.Inspectors;
//inspectors.NewInspector +=
//new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

Application.ItemContextMenuDisplay += new Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(myApp_FolderContextMenuDisplay);

}

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}

void myApp_FolderContextMenuDisplay(Office.CommandBar commandBar, Outlook.Selection Folder)
{

if (Folder[1] is Outlook.ContactItem)
{

var contextButton = commandBar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, 1, true) as Office.CommandBarButton;
contextButton.Visible = true;
contextButton.Caption = "Call Using SoftPhone";
contextButton.Height = 30;

Outlook.ContactItem coni = Folder[1] as Outlook.ContactItem;

contextButton.Parameter = "function=call;number=" + coni.BusinessTelephoneNumber.Replace(";", "").Replace(" ", "") + ";name=" + coni.FileAs.Replace(";", "").Replace(" ", "");
contextButton.Click += new Office._CommandBarButtonEvents_ClickEventHandler(contact_call_click);

// System.Windows.Forms.MessageBox.Show(coni.FirstName + " " + coni.LastName);

}
}

void contact_call_click(Office.CommandBarButton mymenu, ref bool bl)
{


System.Diagnostics.Process.Start("C:\\Users\\BNK\\Desktop\\yesudas\\Popup\\Popup\\bin\\Debug\\Popup.exe", mymenu.Parameter);

// System.Windows.Forms.MessageBox.Show( "Calling " );
}



#region VSTO generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}

#endregion
}
Posted

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