基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

Outlook 2010的主要功能特性:

1 在一个位置管理多个电子邮件帐户您可以方便地管理多个邮箱的电子邮件。从服务(例如 Hotmail、Gmail或Outlook 2010的几乎其他任何提供商)同步多个电子邮件帐户。改进的与Microsoft Exchange Server的连通性支持在某一位置使用和管理多个Exchange Server电子邮件帐户。

  2 方便地管理大量电子邮件Outlook 2010中的“对话视图”在节省宝贵的收件箱空间的同时,改进了跟踪和管理电子邮件对话的功能。将长电子邮件线程压缩到几个几次点击即可分类、归档、忽略或清理的会话中。

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

轻松计划方便高效地安排约会、共享日历可用性和管理工作计划。使用电子邮件日历功能,可以将您的计划发送给其他人,以便他人能够快速找到与您下次约会的时间。如果是在Exchange Server上使用Outlook 2010,可以使用新增的分组计划视图并排查看多个日历,或一起保存某一位置日历的常用分组。

我们来演示一下在Outlook 2010里面加入我们自定义的插件,比如加入一个备忘提醒的小插件,在我们日常商务中繁杂的邮件往来中,您是不是常常因忘记发送某一邮件而导致这笔订单就此OUT了?或是邮件发送邮件不及时而导致公司损失惨重,我们在此开发的这个OutlookAddIn****插件确保您的电子邮件到达预定时间自动弹出提醒您,当您要向大型通讯组列表、办公室以外的某人或组织之外的个人发送电子邮件时,也将出现警告信息,使您不会错过任何一次重要商机,丢掉任何一个客户 。

首先启动VS2010

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

创建一个OutlookAddIn****工程

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

创建后我们在工程里再添加一个名为"form1"的窗体,

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

进入form1页面加入如图所示的各种控件:

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

然后在form.cs中加入下列代码:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace OutlookAddIn { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void 关闭_Click(object sender, EventArgs e) { this.Close(); } private void button2_Click(object sender, EventArgs e) { this.richTextBox1.Clear(); } } }

最后在ThisAddIn.cs中写入如下代码:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using Outlook = Microsoft.Office.Interop.Outlook; using Office = Microsoft.Office.Core; namespace OutlookAddIn { public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { Form1 frm = new Form1(); frm.Show(); frm.TopMost = true; } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { } #region VSTO generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion } }

按下F5开始调试

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

运行界面如下,PowerPoint文档打开了以后,首先弹出备忘提醒的小插件,使您对今天重要必须要做的工作一目了然:

基于Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件