Outlook加载项-选择项目发送中的活动检查器 [英] Outlook Add In - Selecting the Active Inspector on Item Send

查看:93
本文介绍了Outlook加载项-选择项目发送中的活动检查器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在商品发送事件中识别商品类型.我已经很接近那里了,但是如果以前已经打开了另一个窗口,程序将无法识别当前的项目类型.

I am trying to identify the item type on the item send event. I am very close to getting there but the program is not recognising the current item type if a different window has been opened previously.

以下是使用的代码:

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设置为相应的类型.

My understanding of that code, is that when I select the send button, this code will determine the current type of window that is open and set Item to the corresponding type.

非常感谢您提供任何有关为什么此方法不起作用的帮助或指导!

Any help or guidance as to why this is not working would be greatly appreciated!

推荐答案

不,您要做的只是以下操作:

No, all you have to do is the following:

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");
       }
   } 
}

这篇关于Outlook加载项-选择项目发送中的活动检查器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆