VSTO support for Outlook
Steve Ballmer announced VSTO support for Outlook add-ins in his Tech-Ed keynote today. This is exciting news--VSTO Outlook add-ins solve all the problems people have encountered while trying to build managed COM add-ins for Outlook using IDTExtensibility2. For example:
1) VSTO Outlook add-ins load into their own AppDomain--there is no longer a need for you to create a custom C++ shim.
2) VSTO Outlook add-ins solve the "Outlook won't shut down" issue--you no longer have to track every Outlook object you use and set it to null and force a garbage collection or even worse call ReleaseCOMObject on anything. Your add-in will always cleanly shut down.
3) VSTO Outlook add-ins solve the "Trust all installed templates and add-ins" issue. Because the VSTO Outlook add-in loader technology uses the same runtime and security model used by VSTO, if your add-in is trusted by .NET policy, it will work even when Trust all installed templates and add-ins is unchecked.
4) The VSTO Outlook add-in project is all wired up and ready to go. Create a new project, press F5, and Outlook starts up. No extra settings to configure.
5) VSTO Outlook add-ins have a nice strongly typed programming model that is very similar to the VSTO Word & Excel programming models. Say goodbye to the old COM-centric IDTExtensibility2 interface. The Outlook add-in project has a code item called ThisApplication.cs or ThisApplication.vb where you write your code. Instead of being passed a weakly typed application object, the ThisApplication class you write your code derives from a base class that wraps the Outlook application object so you can use "this" in C# and "me" in VB to get to Outlook Application properties, methods, and events. Here what code in a VSTO Outlook add-in looks like:
using System
using System.Windows.Forms;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Outlook = Microsoft.Office.Interop.Outlook;
namespace OutlookAddin1
{
public partial class ThisApplication
{
private void ThisApplication_Startup(object sender, System.EventArgs e)
{
MessageBox.Show(String.Format(
"There are {0} inspectors and {1} explorers open.",
this.Inspectors.Count,
this.Explorers.Count));
this.NewMail += new Outlook.ApplicationEvents_11_NewMailEventHandler(
ThisApplication_NewMail);
}
void ThisApplication_NewMail()
{
MessageBox.Show("New mail!");
}
private void ThisApplication_Shutdown(object sender, System.EventArgs e)
{
MessageBox.Show("Shutting down.");
}
#region VSTO generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisApplication_Startup);
this.Shutdown += new System.EventHandler(ThisApplication_Shutdown);
}
#endregion
}
}
Download VSTO support for Outlook now! https://download.microsoft.com/download/1/4/4/144ef6a4-920b-4aed-9ed8-ed4a7ba7193a/Setup.exe
This installer installs VSTO support for Outlook on top existing VSTO Beta 2 .
Comments
- Anonymous
June 06, 2005
Just read Eric's blog!!! download it here. Very cool stuff.... - Anonymous
April 25, 2006
Goodbye IDTExtensibility2 interface - you can build Outlook Add-ins with VSTO 2005 BETA. Today at TechEd...