Jim Groves
Microsoft Corporation
May 1999
Summary: This article presents an overview of the new programmability features in Outlook 2000. (10 printed pages)
Outlook® 2000 represents the third release of Microsoft's premier e-mail and scheduling client, and arguably it is the most important release for Office developers. Outlook 97 featured powerful forms-customization backed by Microsoft® Visual Basic® Scripting Edition (VBScript) and an extensive object model to support automation, and Outlook 98 extended the object model even further, giving developers more control over Outlook.
Although the additions in Outlook 98 were largely incremental, the enhancements added to Outlook 2000 are little short of revolutionary in their effect on the ability of Office developers to integrate Outlook 2000 into their solutions or perhaps even build new solutions around Outlook.
These enhancements can be grouped into two major categories:
The rest of this article describes the enhancements in these categories and outlines how you can use them.
Outlook 2000 introduces six new features that are designed to make life much easier for Outlook solution developers:
This section describes these new features and suggests how you might be able to use them in your applications.
Outlook 98 introduced Outlook Today, a Web-page view of Outlook that gives users a quick overview of their appointments, tasks, and messages. Now Outlook 2000 gives developers the ability to create Web pages similar to Outlook Today and associate them with any Outlook folder to provide a Web-style view and user interface for Outlook-based applications. Because the full Outlook object model is available to script on the Web page, it is easy to give users access to their Outlook information through the page. You can also add ActiveX® controls to the folder home page, such as the Outlook 2000 View Control (available with Outlook 2000 Team Folders), which provides a rich, Windows® Explorer–like view of any Outlook folder.
Along with other Microsoft Office 2000 applications, Microsoft Outlook 2000 allows you to enhance and extend the application by using Component Object Model (COM) add-ins. A COM add-in is a dynamic-link library (DLL) that's specially registered so that it can be loaded by any Office 2000 application. A COM add-in has full access to the Outlook object model, giving it wide-ranging control over the application.
Prior to Outlook 2000, the only way to create an extension to Outlook was by using Microsoft Exchange Client Extensions. These "legacy" extensions could be developed only in C++ and were notoriously difficult to create. COM add-ins, on the other hand, can be built with Microsoft Visual Basic version 5.0 or later, or Microsoft Office 2000 Developer. You can also create COM add-ins with Microsoft Visual C++® or Microsoft Visual J++®.
Although Outlook 2000 continues to support Exchange Client Extensions for the sake of backward compatibility, developers creating new extensions to Outlook are encouraged to use COM add-ins to be sure that they will be supported in future versions of Outlook.
Shortly after Outlook 2000 is generally available, Outlook 2000 Team Folders will be made available through the Office Update Web site, located at http://officeupdate.microsoft.com/, and other distribution sources. Team Folders makes it easy to build sophisticated team-collaboration applications with Outlook and folder home pages simply by running a wizard. Team Folders provides templates for such applications as group discussion, document libraries, and team calendars. The folder home page that provides the user interface for the team-collaboration applications uses the new Outlook 2000 View Control, an ActiveX control that allows you to embed nearly all the functionality of an Outlook explorer window in a folder home page, making it easy to enhance the user's experience in Outlook without losing the built-in functionality of the Outlook explorer.
An important addition to the customization features found in Outlook 2000 is support for custom property pages. Now you can create your own property page to appear in the Microsoft Outlook Options dialog box (available through the Tools menu of the explorer and inspector windows) or in the Properties dialog box for a folder.
Essentially, a custom property page is an ActiveX control accompanied by a dynamic-link library (DLL) that implements the PropertyPage object and that is installed as a COM add-in. This object provides the interface through which Outlook can query the property page about its status and inform the property page that the user has clicked the Apply or OK button.
With Visual Basic for Applications (VBA), you can write macros to control Outlook 2000. You use the same Visual Basic Editor that is available to other Microsoft Office 2000 applications, giving you a powerful, yet easy-to-use environment in which to customize and extend Outlook.
VBA macros provide a simple way to customize Outlook, especially when you don't need to develop custom forms. You can easily create a toolbar button that runs a macro by using the new toolbar-customization features of Outlook 2000.
One significant limitation of Visual Basic for Applications in Outlook 2000 is that code cannot easily be shared by or distributed to users. However, you can use the Visual Basic Editor to prototype and develop code that can then be packaged and distributed as a COM add-in. (Microsoft Office 2000 Developer provides tools that make it easy to convert VBA code to a COM add-in.) You can also use the Visual Basic Editor to develop code and then copy it to a code module in another Office application.
VBA code modules can also be exported to a file that other users can import into their own VBA projects. Although this method of distributing code is somewhat less than elegant, it is not especially difficult and may be acceptable for users who aren't intimidated by the Visual Basic Editor.
Although earlier versions of Outlook allow you to customize forms, those forms can only be used to affect items when they are created, not when they are received in the user's Inbox. For example, you could customize the standard mail item form and use that form to send a message to another user. As long as the form definition is sent with the item or published in the user's or organization's forms library, the user will be able to view the form as sent. But there is no way, in these earlier versions, to replace a default form with a custom form when it arrives in the user's Inbox.
Outlook 2000, on the other hand, can be configured to use a custom form instead of a built-in Outlook form to display items received in a user's Inbox. For example, a standard mail item is identified with the message class IPM.Note. You can create a customized form version of the IPM.Note form and configure Outlook 2000 to use the custom form to display any item with the IPM.Note message class.
Shortly after Outlook 2000 is widely available, a utility will be made available through the Office Update Web site, located at http://officeupdate.microsoft.com/, that makes it easy to configure Outlook 2000 this way. You can also use this utility to restore the default form for a standard message class.
For Outlook 2000, the Outlook object model was extended with new objects, as well as with new properties, methods, and events added to existing objects.
Many objects were added to support new features added to Outlook. In some cases, objects were added to the Outlook object model to give developers more control over the application from Visual Basic for Applications programs and COM add-ins.
The following list describes objects that were added to the Microsoft Outlook 2000 object model and suggests ways you can use them.
AnswerWizard Object
Represents the Answer Wizard. With this object, you can add (or remove) your application's Answer Wizard (.aw) files to the Answer Wizard files available to Outlook. When you add an Answer Wizard file, the Answer Wizard will use the information in the file to match users' queries to available topics.
COMAddIns Collection
Contains COMAddIn objects (also new in Outlook 2000) representing all COM add-ins loaded in Outlook. You can use this collection to determine if a COM add-in has been installed, or to automatically make a COM add-in available to Outlook while Outlook is running.
DistListItem Object
Represents a distribution list in a contacts folder. A distribution list can contain multiple recipients and is used to send messages to everyone in the list.
Explorers Collection
Contains Explorer objects representing all explorer windows. Using this collection, you can access every Outlook explorer window, not just the active explorer window (as was the case prior to Outlook 2000), and create new explorer windows. You can respond to the collection's NewExplorer event to take appropriate action when Outlook creates a new explorer window.
Inspectors Collection
Contains Inspector objects representing all inspector windows. As with the Explorers collection, you can create and access Outlook inspector windows and use the NewInspector event to detect when a new inspector window has been created.
LanguageSettings Object
Contains information about language settings used by Outlook. You can use this object to determine what language files are installed and in use on the computer.
Links Collection
Contains Link objects (also new in Outlook 2000) representing all items linked to a particular item. Outlook 2000 introduced contact linking, which lets users associate contacts with other Outlook items. For example, a user could link a contact to a task item that reminds the user to call the contact. The Links collection contains the contacts that are linked to a particular item. You could use this collection, for example, to automatically link a contact item for an individual to a contact item representing the individual’s employer.
OutlookBarGroups Collection
Contains OutlookBarGroup objects (also new in Outlook 2000) representing all shortcut groups on the Outlook Bar. You can use this collection to add and remove groups in the Outlook Bar.
OutlookBarPane Object
Represents the Outlook Bar. You use this object to gain access to groups and shortcuts in the Outlook Bar.
OutlookBarShortcuts Collection
Contains OutlookBarShortcut objects (also new in Outlook 2000) representing all the shortcuts in an Outlook Bar group. You can add, remove, and otherwise manage the shortcuts in an Outlook Bar group, making it easier for users to access folders and other elements of your solution.
OutlookBarStorage Object
Represents the storage for objects in the Outlook Bar. You use this object to gain access to groups and shortcuts in the Outlook Bar.
Panes Collection
Contains objects representing panes in an explorer window. You use this collection to gain access to the OutlookBarPane object.
PropertyPages Collection
Contains PropertyPage objects (also new in Outlook 2000) representing all the custom pages added to a dialog box. You add a custom property page to a dialog box by adding it to this collection.
PropertyPageSite Object
Represents the container of a custom property page. This object provides the mechanism for notifying Outlook that the custom property page has changed.
Selection Collection
Contains the set of Outlook items that represent the items currently selected in an explorer window. The new SelectionChange event notifies your program that the user has selected a different item or items. When you respond to this or another event, you can use the Selection collection to find out what the user has selected and respond appropriately.
SyncObjects Collection
Contains SyncObject objects (also new in Outlook 2000) representing the synchronization profiles for a user. You can use these objects to start, stop, and monitor the progress of offline-folder synchronization for a specific a profile. For example, you could create a synchronization manager that would provide the user an easy way to control offline synchronization.
Many of the properties that were added to existing objects provide access to the new Outlook objects. Other properties added to the Outlook object model give you greater control over such objects as Outlook explorer and inspector windows and let you work with new features. This section lists these new properties.
AnswerWizard Property
Applies to the Application object. Returns the application's AnswerWizard object.
Caption Property
Applies to the Explorer and Inspector objects. Returns the title-bar caption.
COMAddIns Property
Applies to the Application object. Returns the application's COMAddIns collection.
CurrentView Property
Applies to the Explorer object. Returns or sets the Explorer object's current view. You can use this property along with the new ViewSwitch event to control the views that can be applied to a given folder, for example.
Explorers Property
Applies to the Application object. Returns the application's Explorers collection.
Height and Width Properties
Applies to the Explorer and Inspector objects. You can use these properties along with the Left and Top properties (see below) to control the size and position of Outlook windows.
Inspectors Property
Applies to the Application object. Returns the application's Inspectors collection.
LanguageSettings Property
Applies to the Application object. Returns the application's LanguageSettings object.
Left and Top Properties
Applies to the Explorer and Inspector objects. You can use these properties along with the Height and Width properties to control the size and position of Outlook windows.
Links Property
Applies to all Outlook items. Returns the Links collection for an item.
NetMeetingDocPathName Property
Applies to the AppointmentItem object. Returns or sets the full path to the Microsoft Office document for a NetMeeting® online meeting.
NetShowURL Property
Applies to the AppointmentItem object. Returns or sets the URL for a Microsoft NetShow™ online meeting.
Panes Property
Applies to the Explorer object. Returns an Explorer object's Panes collection.
Selection Property
Applies to the Explorer object. Returns an Explorer object's Selection collection.
SyncObjects Property
Applies to the NameSpace object. Returns the SyncObjects collection.
WindowState Property
Applies to the Explorer and Inspector objects. You can use this property to minimize, maximize, or restore Outlook windows.
For Outlook 2000, new methods have been added to existing items in the Outlook object model to give you greater control over the Outlook explorer and inspector windows, as outlined in this section.
Activate Method
Applies to the Explorer and Inspector objects. You can use this method to activate Outlook windows, such as in response to an event.
ActiveWindow Method
Applies to the Application object. Returns the topmost Outlook window. This method allows you to determine which Outlook window is the one that the user is most likely to be interacting with.
IsPaneVisible Method
Applies to the Explorer object. Determines whether a specific pane in an explorer window is visible. You can use this to determine whether the Outlook Bar is displayed in a given instance of the Outlook explorer window, for example.
ShowPane Method
Applies to the Explorer object. Displays or hides the specified pane in an explorer window. You use this to control whether a specific pane is available in a given instance of the Outlook explorer window.
Apart from the objects added to the Outlook object model for Outlook 2000, the new events have perhaps the greatest significance for developers. In previous versions of Outlook, events were fired by individual items (primarily to execute VBScript code "behind" the item's form), but there were no events that could notify your program of changes to the state of the application, its windows, or its collections. The Outlook 2000 object model has been extended to include a number of new events that are triggered by objects other than item objects. These new events make it possible to write Outlook VBA macros and COM add-ins that can interact with Outlook as a whole and with its windows and collections.
The following list describes these new events and suggests how you might use them in a program.
Activate Event
Applies to the Explorer and Inspector objects. Notifies you when a particular explorer or inspector window becomes the active window.
AttachmentAdd Event
Applies to all Outlook item objects. Notifies you when an attachment has been added to a specific item.
AttachmentRead Event
Applies to all Outlook item objects. Notifies you when an attachment in a specific item has been opened.
BeforeAttachmentSave Event
Applies to all Outlook item objects. Notifies you when an attachment in a specific item is about to be saved. You can cancel the event to prevent the attachment from being changed.
BeforeCheckNames Event
Applies to all Outlook item objects. Notifies you before Outlook attempts to resolve names in the Recipients collection for an item. You can cancel this event to prevent Outlook from resolving the names.
BeforeFolderSwitch Event
Applies to the Explorer object. Notifies you before Outlook changes the folder displayed in a particular explorer window. You can cancel this event to prevent the user from navigating to a different folder in the explorer window.
BeforeViewSwitch Event
Applies to the Explorer object. Notifies you before Outlook changes the view applied to the folder displayed in a particular explorer window. You can cancel this event to prevent the user from changing the view in the explorer window.
Deactivate Event
Applies to the Explorer and Inspector objects. Notifies you when a particular explorer or inspector window ceases to be the active window.
FolderAdd Event
Applies to the Folders collection object. Notifies you when a folder has been added to a particular collection of folders.
FolderChange Event
Applies to the Folders collection object. Notifies you when a folder has been changed in a particular collection of folders.
FolderRemove Event
Applies to the Folders object. Notifies you when a folder has been removed from a particular collection of folders.
FolderSwitch Event
Applies to the Explorer object. Notifies you that a different folder has been displayed in a particular explorer window.
ItemAdd Event
Applies to the Items collection object. Notifies you when an item has been added to a particular collection of items.
ItemChange Event
Applies to the Items collection object. Notifies you when an item has been changed in a particular collection of items.
ItemRemove Event
Applies to the Items collection object. Notifies you when an item has been removed from a particular collection of items.
ItemSend Event
Applies to the Application object. Notifies you when an item is about to be sent. You can cancel this event to prevent the item from being sent.
NewMail Event
Applies to the Application object. Notifies you when one or more items have been received in the user's Inbox. You can respond to this message by activating the Outlook explorer window when a high-priority message has been received, for example.
OptionsPagesAdd Event
Applies to the Application and NameSpace objects. Notifies you when the Options dialog box or a folder's Properties dialog box is about to be opened so that you can add a custom property page to the dialog box.
Quit Event
Applies to the Application object. Notifies you when Outlook is about to close. You can use this event to save data that needs to be retained between sessions, for example.
Reminder Event
Applies to the Application object. Notifies you when Outlook is about to display a reminder for a particular object. You can respond to this event by sending a message to an alphanumeric pager, for example.
SelectionChange Event
Applies to the Explorer object. Notifies you when the user has changed the items selected in an explorer window.
Startup Event
Applies to the Application object. Notifies you when Outlook is starting. You can use this event to initialize your program.
ViewSwitch Event
Applies to the Explorer object. Notifies you when Outlook has changed the view used to display a folder in a particular explorer. You can respond to this event by hiding the preview pane when the user switches a view with AutoPreview enabled, for example.
Two books are available through Microsoft Press® that have up-to-date information about developing solutions with Outlook 2000: