【发布时间】:2014-08-21 19:13:53
【问题描述】:
我正在开发 VSTO Outlook2010 客户端插件。我有一个功能区,它显示在新的电子邮件资源管理器窗口中。我需要编写一个在新电子邮件窗口关闭时执行某些操作的方法。我知道在发送电子邮件时窗口会自行关闭,但我需要一种在窗口关闭而不发送电子邮件时触发的方法,例如当用户想要取消时。
任何带有示例代码的想法都将受到高度赞赏。
我从其他帖子中尝试过。下面两行说:不能隐式转换类型 .存在显式转换。你错过了演员表吗?
Inspector OpenedMailItem;
//within the start-up method
Inspector insp = this.Application.Inspectors;
insp.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OnNewInspector);
//new function, within class
public void OnNewInspector(Outlook.Inspector inspector)
{
if (inspector.CurrentItem is Microsoft.Office.Interop.Outlook.MailItem)
{
OpenedMailItem = inspector.CurrentItem as Microsoft.Office.Interop.Outlook.MailItem;
((ItemEvents_10_Event)OpenedMailItem).Close += new Outlook.ItemEvents_10_CloseEventHandler(MailItem_Close);
}
}
void(MailItem)
{
//something
}
出现很多错误并悬停在 sasy 上:无法隐式转换类型 .存在显式转换。你错过了演员表吗?
我正在导入所有这些:
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;
using Excel = Microsoft.Office.Interop.Excel;
using System.Windows.Forms; using System.Net;
using System.Web; using System.IO;
using System.Text.RegularExpressions;
using Redemption;
using System.Runtime.InteropServices;
using Microsoft.Office.Interop.Outlook;
using Exception = System.Exception;
【问题讨论】:
标签: c# outlook vsto outlook-addin visual-studio-addins