【问题标题】:Outlook Add In - Selecting the Active Inspector on Item SendOutlook 加载项 - 在项目发送时选择活动检查器
【发布时间】:2016-06-14 03:29:45
【问题描述】:

我正在尝试在项目发送事件中识别项目类型。我非常接近到达那里,但如果之前打开了不同的窗口,程序将无法识别当前的项目类型。

这里是使用的代码:

void Application_ItemSend(object Item, ref bool Cancel)
    {
        inspectors = this.Application.Inspectors;
        currentExplorer = this.Application.ActiveExplorer();
        currentExplorer.InlineResponse += ThisAddIn_InlineResponse;
        Outlook.Inspector inspector = Application.ActiveInspector();
        Item = inspector.CurrentItem;

        try
        {
            //Item = inspector.CurrentItem;
            if (Item == currentAppointment)
            {
                TypeCheck = "inspector";
            }

我对那段代码的理解是,当我选择发送按钮时,这段代码会判断当前打开的窗口类型,并将Item设置为对应的类型。

任何关于为什么这不起作用的帮助或指导将不胜感激!

【问题讨论】:

    标签: c# outlook vsto add-in outlook-addin


    【解决方案1】:

    不,您只需执行以下操作:

    void Application_ItemSend(object Item, ref bool Cancel)
    {
       Outlook.MailItem mailItem = Item as Outlook.MailItem;
       if (mailItem != null)
       {
           MessageBox.Show("I am a MailItem");
       }
       else
       {
          Outlook.MeetingItem meetingItem = Item as Outlook.MeetingItem;
          if (meetingItem != null)
          {
              MessageBox.Show("I am a MeetingItem");
           }
       } 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-18
      相关资源
      最近更新 更多