【问题标题】:Outlook 2013: Visual Studio Plugin to get access to email contentOutlook 2013:用于访问电子邮件内容的 Visual Studio 插件
【发布时间】:2015-12-15 13:54:09
【问题描述】:

我正在尝试为 Outlook 2013 编写一个处理电子邮件内容的插件。

到目前为止,我已经在 Visual Studio 中创建了一个 Outlook 插件项目。此外,我创建了一个功能区按钮,其中

RibbonType = Microsoft.Outlook.Mail.Read

仅在阅读电子邮件时显示按钮。

是否有可能访问电子邮件以便例如显示主题或内容(由纯文本组成)?

private void button1_Click(object sender, Ribbon ControlEventArgs e) 
     { 
        System.Windows.Forms.MessageBox.Show( ... ); 
     }

【问题讨论】:

    标签: c# visual-studio outlook outlook-addin outlook-2013


    【解决方案1】:

    使用RibbonControlEventArgs.Control 属性获取RiibbonControl 对象。然后,您可以使用IRibbonControl.Context 属性并将其转换为Inspector 对象(用于检查员)或Explorer(用于资源管理器按钮)。拥有 Inspector 对象后,使用 Inspector.CurrentItem 属性。

    【讨论】:

      【解决方案2】:

      感谢德米特里的帮助!

      private void button1_Click(object sender, RibbonControlEventArgs e) 
      {
          var mailItem = ((Inspector) e.Control.Context).CurrentItem;
          MessageBox.Show(mailItem.Subject);
          MessageBox.Show(mailItem.Body);
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-11
        • 2016-04-18
        • 1970-01-01
        • 2015-05-11
        相关资源
        最近更新 更多