目标 : 在 ADD-IN 中, 我需要阻止日历通知发送到参与者, 但同时我要在点击发送按钮时执行某些自定义动作 。 简而言之, 我只需要执行与发送按钮相关的自定义动作, 而不是 SEND 按钮的默认函数 。
我使用VSTO2010,MS Office 2007.net 4.
我要了解2003、2007、2010年女士的情况(对2007和2010年的支持就足够了)。
目标 : 在 ADD-IN 中, 我需要阻止日历通知发送到参与者, 但同时我要在点击发送按钮时执行某些自定义动作 。 简而言之, 我只需要执行与发送按钮相关的自定义动作, 而不是 SEND 按钮的默认函数 。
我使用VSTO2010,MS Office 2007.net 4.
我要了解2003、2007、2010年女士的情况(对2007和2010年的支持就足够了)。
您需要拦截 < code> OnClick 事件在 < code> CommandBar 上的发送按钮。 是的, 尽管 Outlook 2010 使用丝带而不显示任何命令栏, 但仍有一个包含按钮的程序 < code> CommandBar 。 为了兼容性, 丝带按钮仍然导致相应的 < code> CommandBarbutton 对象引发事件 。
加上复杂性,在“任命”变成“会议”之前,您想要的按钮是不存在的。
您需要一些字段 :
private CommandBars mCommandBars;
private CommandBarButton mCommandButtonSendMeeting;
在您的 NewInspect
事件中,添加这些行
mCommandBars = this.Inspector.CommandBars;
mCommandBars.OnUpdate += CommandBars_OnUpdate;
在别处
private void CommandBars_OnUpdate()
{
if (mCommandButtonSendMeeting == null)
{
mCommandButtonSendMeeting = (CommandBarButton)CommandBars.FindControl(Missing.Value, 2617, Missing.Value, Missing.Value);
mCommandButtonSendMeeting.Click += CommandButtonSendMeeting_Click;
}
}
private void CommandButtonSendMeeting_Click(CommandBarButton Ctrl, ref bool CancelDefault)
{
CancelDefault = true;
// Do whatever here.
}
您在这里有一个不同的解决方案。 您真的不需要触摸按钮, 按钮与按钮无关。 您必须使用 Outlook 提供的用于这些目的的事件。 请在您的 Add- in_ startUp 中加入此行 :
Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
当然,事件处理程序的实施:
void Application_ItemSend(object Item, ref bool Cancel)
{
MessageBox.Show("Yihha!!");
Cancel = true;
}
这将拦截您发送的任何信息。 工作于2010年展望 。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...