Share via


Announcing VSTO 2005 for Outlook 2003

Today during Steve Ballmer’s keynote speech he announced VSTO for Outlook. Now in addition to Word and Excel, you can create Outlook add-ins using VSTO 2005 for Office 2003. VSTO will create managed add-ins for Outlook that will appear to Outlook as a COM add-in. VSTO for Outlook also fixes some of the problems associated with managed add-ins for Outlook. You no longer need a COM Shim or worry about the shutdown bug.

Here are the links where you can install VSTO for Outlook.

Getting Started – Start with this one first

Architecture Overview

Hands-on Labs

Snippets

Visual Studio Tools for the Microsoft Office System

 

 Let’s create a simple add-in that counts the number of items in my inbox. First you need to install VSTO for Outlook. Next open Visual Studio and create a new Outlook project; either VB or C#, in this case I will use VB called CountInboxItems.

Now we can code our project. Here is the entire code.

public class ThisApplication

    Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

        'When the Add-in starts display a message box with the number of inbox items

        'Get a reference to the Inbox

        Dim Inbox As Outlook.MAPIFolder

        Inbox = Me.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)

        'Display the Inbox message count

        MessageBox.Show("You have " & Inbox.Items.Count & " messages in you inbox.")

    End Sub

    Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown

    End Sub

End class

Press F5 to run the application. Outlook starts and displays a messagebox with the inbox count.