如何对Outlook添加右键菜单

摘要:
//如果使用VSTO2005进行开发,可以添加右键菜单,如下所示:Outlook。ExplorerClass_ Explorer=空;办公室CommandBars_CommandBars=空;object_ Missing=System.Reflection.Missing。价值办公室CommandBarButton_ContextMenuButton=空;女贞

// 如果你用VSTO2005开发有以下办法添加右键菜单:
Outlook.ExplorerClass _Explorer = null;
Office.CommandBars _CommandBars = null;
object _Missing = System.Reflection.Missing.Value;
Office.CommandBarButton _ContextMenuButton = null;
private void ThisApplication_Startup(object sender, System.EventArgs e)
{

_Explorer = (Outlook.ExplorerClass)this.ActiveExplorer();
_CommandBars = _Explorer.CommandBars;
_CommandBars.OnUpdate += new Microsoft.Office.Core._CommandBarsEvents_OnUpdateEventHandler(_CommandBars_OnUpdate);


}
void _CommandBars_OnUpdate()
{
foreach (Office.CommandBar bar in _CommandBars)
{
if (bar.Name == "Context Menu")
{
// we found the context menu
Office.MsoBarProtection oldProtection = bar.Protection;
bar.Protection = Microsoft.Office.Core.MsoBarProtection.msoBarNoProtection;
_ContextMenuButton = (Office.CommandBarButton)bar.Controls.Add(Office.MsoControlType.msoControlButton, 1, _Missing, _Missing, true);
_ContextMenuButton.Style = Microsoft.Office.Core.MsoButtonStyle.msoButtonIconAndCaption;
_ContextMenuButton.TooltipText = "Isabella's Context menu....";
_ContextMenuButton.BeginGroup = true;
_ContextMenuButton.Caption = "Click me...";
_ContextMenuButton.Visible = true;
_ContextMenuButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(_ContextMenuButton_Click);
bar.Protection = oldProtection;
}
}
}
void _ContextMenuButton_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
{
MessageBox.Show("Hey, you clicked the Contextbutton !");
}

源:http://www.cnblogs.com/Isabella/articles/contextMenu.html

免责声明:文章转载自《如何对Outlook添加右键菜单》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Matlab并行编程方法1关于xpath的应用下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

教你在Android手机上使用全局代理

这样,QQ、飞信和微博等个人应用就不能使用系统代理。ProxyDroid可以帮助您解决此问题!使用方法和步骤如下:1.建议从Google Play下载ProxyDroid。最新版本为v2.6.6。NTLM身份验证:NTLM/NTLM2(早期的Windows身份验证方法)未选中。DNSProxy:启用DNS代理。...

java报表实现excel一样冻结表头的功能

增加了几个新的指标,后台sql改了,拿过来只须在一个dao类中修改就足够了,可恨的是客户又提出来改报表表样,加个类似excel冻结表头的功能。...

USBWriter之后恢复磁盘大小

USBWriter之后恢复磁盘大小的方法:1,cmd2,diskpart3,listdisk4,selectdisk*5,clean6、在我的电脑点右键,管理,然后选磁盘管理,选择USB后,右键,然后再新建卷就可以了。...

MySQL学习笔记:字符串前后补全0

遇到一个要求:如果位数小于6,则需要使用函数LPAD()和RPAD()自动完成6位。LPAD使用字符串padstr填充并完成左侧的str,直到其长度达到len个字符,并返回str。...

WPF 制作圆角按钮

在程序对应坐置插入以下代码,或是先拖一个按钮控件到窗体中,再替换对应的代码。...

linux系统redhat7.9安装R

1.查看系统信息[root@localhosthome]#cat/etc/redhat-releaseRedHatEnterpriseLinuxServerrelease7.9(Maipo)[root@localhosthome]#lsb_release aLSB版本::core-4.1-amd64:core-4.1-noarch:ccxx-4.1-amd6...