本文介绍了Outlook Addin功能区项目上下文菜单不会出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
我正在开发Outlook 2013 Addin。我正在使用功能区控件来显示联系人项目的上下文菜单。其他一切都在发挥作用。但菜单没有出现....请帮助...
这是色带代码....
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 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();
}
谢谢大家......
Thanks Everybody.....
这篇关于Outlook Addin功能区项目上下文菜单不会出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!