【问题标题】:outlook vsto perform custom send messageOutlook vsto 执行自定义发送消息
【发布时间】:2012-10-27 21:53:12
【问题描述】:

我有一个 Outlook 插件,它在撰写检查器窗口的 NewMailMessage 选项卡中添加了一个自定义发送按钮。单击此自定义按钮时,我想在实际发送之前对正在发送的电子邮件进行一些修改。如何从按钮单击事件中获取电子邮件?在 Outlook 2010 之前的旧版本中,我知道您可以通过编程方式获取“发送”CommandBar 按钮并在其上调用Execute 以模拟发送消息。但是在 2010 及更高版本中,此方法已被弃用。 MSDN 建议为功能区自定义实现 IRibbonExtensibility,但我需要这样做吗?

【问题讨论】:

  • 我找到了答案: if (this.Context is Outlook.Inspector) { Outlook.Inspector oInsp = this.Context as Outlook.Inspector; if (oInsp.CurrentItem is Outlook.MailItem) { Outlook.MailItem oMail = oInsp.CurrentItem as Outlook.MailItem; ((Outlook._MailItem)oMail).Send(); } }

标签: c# outlook add-in


【解决方案1】:

我找到了答案:

if (this.Context is Outlook.Inspector)
{
    Outlook.Inspector oInsp = this.Context as Outlook.Inspector;
    if (oInsp.CurrentItem is Outlook.MailItem)
    {
        Outlook.MailItem oMail = oInsp.CurrentItem as Outlook.MailItem;
        ((Outlook._MailItem)oMail).Send();
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-09
    • 1970-01-01
    • 2021-01-02
    相关资源
    最近更新 更多