c#-4.0 - 覆盖 Outlook 的默认发送功能

标签 c#-4.0 vsto outlook-addin outlook-2010

我正在使用 VSTO、VS 2010 和 Outlook 2010 开发 Outlook 解决方案。

我想覆盖 Outlook 发送行为的默认功能。

这是要求。

当用户点击发送按钮时,我必须检查它是否是短信 - “IPM.Note.Mobile.SMS”。如果它是短信,那么我必须提供我的自定义实现来发送。如果不是 SMS,则默认发送行为。

对于自定义发送部分,我必须使用自己的网络服务并处理它。

我希望您提供一种方法/方式来覆盖 Outlook 2010 中的默认发送功能

我已经阅读了几篇关于 MSDN、inspector wrappers 和执行自定义业务规则的文章,但我没有得到我想要的。我想要一个纯 C# 解决方案,而不是像赎回这样的第三方 dll。我试图尽可能具体,我希望是一样的:)

请帮助我:D 谢谢,

问候 - 山姆

最佳答案

您需要处理 Microsoft.Office.Interop.Outlook.Send 事件 (ItemEvents_10_SendEventHandler)。可以看引用here .下面提供了一个粗略的示例。您可以从检查器中获取消息类,从应用程序引用中获取事件检查器。

((Outlook.ItemEvents_10_Event)inspector.CurrentItem).Send += new Outlook.ItemEvents_10_SendEventHandler(Inspector_Send);

void Inspector_Send(ref bool Cancel)
        {
            if (IPM.Note.Mobile.SMS) 
            {
               // custom implementation
            }
            else
              Cancel = true; // don't send the message out 
        }

关于c#-4.0 - 覆盖 Outlook 的默认发送功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7962837/

相关文章:

C#异步方法的使用

c# - 使用 Inspector 以编程方式加密 Outlook 电子邮件

c# - TabAppointment 选项卡中的 Outlook 2010 加载项

c# - Word VSTO 加载项 : How to set the width of a custom task pane?

c# - Excel 错误 HRESULT : 0x800A03EC while trying to get range with cell's name

c# - VSTO:电子邮件编辑器插件 - 获取当前光标位置

dynamic - 你如何实现 C#4 的 IDynamicObject 接口(interface)?

linq - 尝试使用表达式树过滤 Nullable 类型

sql - 验证 SQL 查询和结果集

excel - VSTO Excel : How to make a custom column mapping with ListObject?