<?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>
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!"); } } }
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() { return new Ribbon1(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)