Outlook 2013 加载项 - "Popped in" window 电子邮件回复和转发:接口类型是什么?
Outlook 2013 Add In - "Popped in" window on email replys and forwards: What is the interface type?
我一直在为Outlook 2013开发一个插件,目前发现很难找到Outlook 2013回复和转发邮件时出现的"Popped in" window的界面类型.
例如:对于新邮件,接口类型是Outlook.MailItem,对于会议请求,接口类型是Outlook.AppointmentItem。
我可以使用什么界面类型来识别在 Outlook 2013 中回复和转发时出现的 window 中的弹出消息?
当您回复或转发邮件项目时,新项目将是一个 MailItem 对象。您可以使用以下代码来确定项目类型:
Object selObject = this.Application.ActiveExplorer().Selection[1];
if (selObject is Outlook.MailItem)
{
Outlook.MailItem mailItem =
(selObject as Outlook.MailItem);
itemMessage = "The item is an e-mail message." +
" The subject is " + mailItem.Subject + ".";
mailItem.Display(false);
}
else if (selObject is Outlook.ContactItem)
{
Outlook.ContactItem contactItem =
(selObject as Outlook.ContactItem);
itemMessage = "The item is a contact." +
" The full name is " + contactItem.Subject + ".";
contactItem.Display(false);
}
else if (selObject is Outlook.AppointmentItem)
{
Outlook.AppointmentItem apptItem =
(selObject as Outlook.AppointmentItem);
itemMessage = "The item is an appointment." +
" The subject is " + apptItem.Subject + ".";
}
else if (selObject is Outlook.TaskItem)
{
Outlook.TaskItem taskItem =
(selObject as Outlook.TaskItem);
itemMessage = "The item is a task. The body is "
+ taskItem.Body + ".";
}
else if (selObject is Outlook.MeetingItem)
{
Outlook.MeetingItem meetingItem =
(selObject as Outlook.MeetingItem);
itemMessage = "The item is a meeting item. " +
"The subject is " + meetingItem.Subject + ".";
}
有关详细信息,请参阅 How to: Programmatically Determine the Current Outlook Item。
您也可以考虑检查 MailItem class 的 MessageClass 属性。 MessageClass 属性 将项目链接到它所基于的表单。选择项目后,Outlook 使用消息 class 来定位表单并公开其属性,例如回复命令。
我的经理和我坐在一起解决了这个问题,幸运的是找到了解决方案。您可以使用以下代码
访问"popped in"回复和转发windows
//First, declare the interface type of Explorer
public static Outlook.Explorer currentExplorer;
//Create a method to identify the Inline response as a MailItem
private void ThisAddIn_InlineResponse(object Item)
{
if (Item != null)
{
Outlook.MailItem mailItem = Item as Outlook.MailItem;
}
}
//Direct to the ThisAddIn_Startup() method and add an event handler for the Inline Response Method
currentExplorer.InLineResponse += ThisAddIn_InLineResponse;
//Access the popped in reply and forward window where required
object item = null;
item = currentExplorer.ActiveInlineResponse;
我一直在为Outlook 2013开发一个插件,目前发现很难找到Outlook 2013回复和转发邮件时出现的"Popped in" window的界面类型.
例如:对于新邮件,接口类型是Outlook.MailItem,对于会议请求,接口类型是Outlook.AppointmentItem。
我可以使用什么界面类型来识别在 Outlook 2013 中回复和转发时出现的 window 中的弹出消息?
当您回复或转发邮件项目时,新项目将是一个 MailItem 对象。您可以使用以下代码来确定项目类型:
Object selObject = this.Application.ActiveExplorer().Selection[1];
if (selObject is Outlook.MailItem)
{
Outlook.MailItem mailItem =
(selObject as Outlook.MailItem);
itemMessage = "The item is an e-mail message." +
" The subject is " + mailItem.Subject + ".";
mailItem.Display(false);
}
else if (selObject is Outlook.ContactItem)
{
Outlook.ContactItem contactItem =
(selObject as Outlook.ContactItem);
itemMessage = "The item is a contact." +
" The full name is " + contactItem.Subject + ".";
contactItem.Display(false);
}
else if (selObject is Outlook.AppointmentItem)
{
Outlook.AppointmentItem apptItem =
(selObject as Outlook.AppointmentItem);
itemMessage = "The item is an appointment." +
" The subject is " + apptItem.Subject + ".";
}
else if (selObject is Outlook.TaskItem)
{
Outlook.TaskItem taskItem =
(selObject as Outlook.TaskItem);
itemMessage = "The item is a task. The body is "
+ taskItem.Body + ".";
}
else if (selObject is Outlook.MeetingItem)
{
Outlook.MeetingItem meetingItem =
(selObject as Outlook.MeetingItem);
itemMessage = "The item is a meeting item. " +
"The subject is " + meetingItem.Subject + ".";
}
有关详细信息,请参阅 How to: Programmatically Determine the Current Outlook Item。
您也可以考虑检查 MailItem class 的 MessageClass 属性。 MessageClass 属性 将项目链接到它所基于的表单。选择项目后,Outlook 使用消息 class 来定位表单并公开其属性,例如回复命令。
我的经理和我坐在一起解决了这个问题,幸运的是找到了解决方案。您可以使用以下代码
访问"popped in"回复和转发windows//First, declare the interface type of Explorer
public static Outlook.Explorer currentExplorer;
//Create a method to identify the Inline response as a MailItem
private void ThisAddIn_InlineResponse(object Item)
{
if (Item != null)
{
Outlook.MailItem mailItem = Item as Outlook.MailItem;
}
}
//Direct to the ThisAddIn_Startup() method and add an event handler for the Inline Response Method
currentExplorer.InLineResponse += ThisAddIn_InLineResponse;
//Access the popped in reply and forward window where required
object item = null;
item = currentExplorer.ActiveInlineResponse;