• Introduction - Who Should Use This Book
  • Chapter 1 - Applications You Can Create with Outlook
  • Types of Applications You Can Create
  • Forms You Can Create
  • Folder Applications
  • Chapter 2 - Outlook Design Tools
  • Help and Web Sites
  • Outlook Form Design Mode
  • Outlook Visual Basic for Applications Design Tools
  • Other Tools and Add-Ins
  • Chapter 3 - Customize Built-In Modules
  • Overview of the Folder You Create
  • Create New Folders
  • Create Custom Views
  • Create Items for the Beta Contacts Folder
  • Enter Dates in the Beta Participants View
  • Customize the Contacts Form
  • Test the Form at Design Time
  • Publish the Form
  • Specify the Default Form for the Folder
  • Test the Application
  • Delete the Items You Created
  • Copy the Folder to Public Folders
  • Set Permissions
  • Release the Application
  • Chapter 4 - Design a Custom Application
  • Overview of the Product Ideas Application
  • Create the Product Ideas Folder
  • Create the Product Idea Form
  • Create the Product Idea Response Form
  • Set the Actions
  • Create the Product Category View
  • Specify the Default Form for the Folder
  • Set the Hidden Property for the Product Idea Response Form
  • Test the Application
  • Copy the Folder to Public Folders
  • About Folder Permissions
  • Release the Application
  • Chapter 5 - Forms
  • Become Familiar with Designing Forms and Form Components
  • Fields
  • Learn How Forms Work
  • Create a Folder
  • Open the Form and Switch to Design Mode
  • Edit Form Pages
  • Add Controls
  • Create and Bind Fields
  • Polish the Layout
  • Create Help (Optional)
  • Edit the Read Page
  • Set Action Properties
  • Set Form Properties
  • Publish the Form
  • Test and Release the Form
  • Where To Go from Here
  • Chapter 6 - Controls, Fields, and Properties
  • Set Control Display Properties
  • Layer Controls
  • Set Advanced Control Properties
  • Bind a Control to an Existing Field
  • Create User-Defined Fields
  • Set Initial Field Values
  • Validate and Restrict Data
  • Set Field-Specific Properties
  • About the Control Toolbox
  • Set Control-Specific Properties
  • Image Controls
  • Where to Go from Here
  • Chapter 7 - Actions
  • Voting Buttons for Message Forms
  • Reply Actions for Message Forms
  • Reply To Folder Actions for Post Forms
  • Where To Go from Here
  • Chapter 8 - Folders
  • An Important Reminder About Planning
  • Create or Select a Folder
  • Publish Forms in the Folder
  • Design Folder Views
  • Use Folder Home Pages
  • Set General Properties
  • Test Forms and Views
  • Copy the Folder to Public Folders
  • Specify Internet Newsgroup
  • Set Administration Properties
  • Set Permissions
  • Design Rules
  • Make the Folder Available for Offline Use
  • Test and Release the Folder
  • Where To Go from Here
  • Chapter 9 - Raise Events and Move to the Head of the Class
  • The VBA Editor
  • Writing an Outlook Macro
  • Writing Code to Respond to Events
  • Application Events
  • Reminders Collection Events
  • NameSpace Events
  • Explorers Collection Events
  • Explorer Events
  • SyncObject Events
  • OutlookBarPane Events
  • OutlookBarGroup Events
  • OutlookBarShortcut Events
  • Inspectors Collection Events
  • Inspector Events
  • Folders Collection Events
  • Views Collection Events
  • Items Collection Events
  • Item Events
  • Firing Order of Events
  • Where To Go from Here
  • Chapter 10 - The Outlook Development Environment
  • The Outlook E-Mail Security Update
  • Trusted COM Add-Ins
  • Outlook and VBA
  • VBScript Versions
  • The Outlook Script Editor
  • Troubleshooting Code Using the Microsoft Script Editor
  • How To Open an Item Containing VBScript
  • Information Resources for Programming Outlook 2002
  • Object Libraries
  • Object Models
  • Where To Go from Here
  • Chapter 11 - Using Visual Basic, VBA, or VBScript with Outlook
  • The Application Object
  • The NameSpace Object
  • The Outlook Window (Explorer Objects)
  • The Panes Collection Object
  • The OutlookBarStorage Object
  • The OutlookBarGroups Collection Object
  • The OutlookBarShortcuts Collection Object
  • The CommandBars Collection Object
  • The CommandBarControls Collection Object
  • The AddressLists Collection Object
  • The AddressList Object
  • The AddressEntries Collection Object
  • The AddressEntry Object
  • The Folders Collection Object
  • The MAPIFolder Object
  • The Views Collection Object
  • The Items Collection Object
  • The PostItem Object
  • The MailItem Object
  • The DocumentItem Object
  • The AppointmentItem Object
  • The MeetingItem Object
  • The TaskItem Object
  • The TaskRequestItem Object
  • The ContactItem and DistListItem Objects
  • The JournalItem Object
  • The Item Window (Inspector Objects)
  • The Pages Collection Object
  • The Page Object
  • The Controls Collection Object
  • The Control Object
  • The UserProperties Collection Object
  • The ItemProperties Collection Object
  • The Recipients Collection Objec
  • Automation
  • Where To Go from Here
  • Chapter 12 - The Northwind Contact Management Application
  • Overview
  • Setting Up the Application
  • Loading the Company and Company Contact Forms
  • The Company Form
  • Other Application Forms
  • The Outlook Shared Activities Add-In
  • Application Folder Views
  • Releasing the Northwind Contact Management Application
  • Customizing the Application
  • Where To Go from Here
  • Chapter 13 - Distributing and Securing Applications
  • Distribute Forms
  • Manage Forms
  • Modify Forms
  • The Forms Cache
  • Form Activation
  • Distribute and Manage Folders
  • Outlook 2002 Security
  • CDO Security
  • Administrative Options
  • The Outlook Security Form
  • Creating Custom Security Settings
  • Where To Go from Here
  • Chapter 14 - Creating COM Add-Ins with Visual Basic
  • Tools Needed to Create COM Add-Ins
  • The COMAddIns Collection Object
  • COMAddIn Object
  • Displaying the List of COM Add-Ins
  • Creating an Outlook COM Add-In Project in Visual Basic
  • What Is a COM Add-In?
  • Building a COM Add-In
  • Adding Property Pages
  • Modifying Command Bars
  • Adding Dialog Boxes
  • The Debugging Process
  • Compiling Your COM Add-In
  • Sample COM Add-Ins
  • Add-In Registration
  • Providing Security
  • Deploying Your COM Add-In
  • Where To Go from Here
  • Chapter 15 - Integrating Outlook with Web Applications
  • What Folder Home Pages Are
  • What Folder Home Pages Are Not
  • Folder Home Page Security
  • The Outlook Today Page
  • Tools to Create Folder Home Pages
  • The Outlook View Control
  • Digital Dashboards
  • Creating My Dashboard
  • Designing Web Parts with Office XP Developer
  • The Northwind Digital Dashboard
  • Communicating Between Web Parts
  • Putting It All Together
  • Where to Go from Here
  • Chapter 16 - Using Outlook with SharePoint Portal Server
  • SharePoint Portal Server Evaluation Edition
  • SharePoint Portal Server Platform
  • Document Management
  • Content Indexing and Searches
  • The Power of Subscription
  • Outlook Integration with SharePoint Portal Server
  • The Outlook Shared Activities Add-In
  • The PKMCDO Object Model
  • An Outlook COM Add-In for SharePoint Portal Server
  • SharePoint Development Opportunities
  • Where to Go from Here
  • Author Bio
  • Tell Us What You Think
  • Full-Text Search
  • Use Full-Text Search
  • Advanced Full-Text Search
  • Search for Information
  • Find Information with Advanced Full-Text Search
  • Search for Words or Phrases
  • Define Search Terms
  • Use Nested Expressions
  • Search for Words in the Titles of Topic Files
  • Find Words Similar to Your Search Term
  • Create a List of Favorite Topics
  • Search Previous Results
  • eBooks_common_files21.shtmll
  • External Links
  • Enlarge Graphics
  • Use Accessibility Shortcut Keys
  • Use the Shortcut Menu Commands
  • To Turn On MouseKeys
  • Customize the Help Viewer
  • Print the Current Topic
  • C ++
  • Introduction - Who Should Use This Book

    This book is designed primarily for Microsoft Outlook application developers using Microsoft Exchange Server. Many of the examples assume that you’ll be deploying workgroup applications in an Exchange Server environment using both public and private folders. It’s also assumed that you’ll be using Outlook 2002 to run the applications in this book. Although many of the techniques discussed in this book can be used in prior versions of Outlook, you won’t be able to take full advantage of the code examples and sample applications unless you’ve installed Outlook 2002.

    Part I, "Introducing Microsoft Outlook 2002," provides you with a broad perspective on what you can accomplish using Outlook as a development platform. You’ll learn about some tools and add-ins included on the companion CD that will make your life easier as an Outlook developer. In Part II, "Quick Guide to Building Applications," both programmers and nonprogrammers can pick up this book and find the information they need to develop groupware applications. Part III, "Building Blocks of Applications," gives you a solid foundation on which to build more complex Outlook applications. You’ll understand that Outlook applications are developed using the core objects of messages and folders, and you’ll learn how to customize Outlook forms to create an Outlook application.

    In Part IV, "Beyond the Basics," you’ll learn how to use events in the Outlook object model to write event-aware code. After an introduction to the Outlook development environment, you will be able to write Microsoft Visual Basic or Microsoft Visual Basic Scripting Edition (VBScript) code to create more sophisticated applications than you can using Outlook’s built-in modules. You’ll learn about the critical Outlook E-Mail Security Update that is built into Outlook 2002 and how you can work with this component of Outlook to protect your personal and private data from e-mail worms and viruses. I’ll also extend what you’ve learned in a complete customer relationship management (CRM) sample application that operates both on line and off line. Part V, "Advanced Topics," is for developers who are at an intermediate or advanced level in Visual Basic. Step-by-step instructions are included that show you how to create COM Add-ins that replace Exchange Client Extensions and provide Outlook functionality that you only dreamed of in the past. You’ll learn about the new Outlook 2002 View Control, folder home pages, and integrating Outlook with Digital Dashboards and Web Parts. Finally, you’ll see how to add document management and powerful search capabilities to your Outlook applications with SharePoint Portal Server 2001.

    More Detail on How This Book Is Organized

    This book consists of the following five parts and sample applications.

    Part I Introducing Microsoft Outlook 2002

    Chapter 1, "Applications You Can Create with Outlook," discusses the processes and problems best suited for Outlook solutions and shows you the kind of Request, Discussion, Tracking, and Reference applications you can build to streamline communications in your organization. Chapter 2, "Outlook Design Tools," showcases the tools available for creating Outlook forms and for building COM Add-Ins and folder home pages by using Microsoft Office XP Developer, Visual Basic, and Microsoft Visual InterDev. Chapter 2 also introduces you to evaluation versions of important third-party tools and Microsoft SDKs that are included on the companion CD.

    Part II Quick Guide to Building Applications

    Chapter 3, "Customize Built-In Modules," shows you how to create instant groupware applications by modifying the built-in Contacts application, customizing it for tracking customer correspondence related to a beta program, and then copying it to Public Folders on Exchange Server. Chapter 4, "Design a Custom Application," shows you how to build a Discussion application called Product Ideas that makes it possible for users to submit, read, and respond to new products ideas.

    Part III Building Blocks of Applications

    Chapter 5, "Forms," introduces the form design process, and covers fundamental form design tasks such as adding controls and fields, creating new actions, setting form properties, and publishing forms. Chapter 6, "Controls, Fields, and Properties," covers the fundamental skills and information you need to effectively use controls, fields, and properties on a form. It also explains the unique features of each commonly used control, and then offers some strategies for implementing these controls and fields in an application. Chapter 7, "Actions," discusses the easiest way to create responses for Message forms, explains how to create custom Reply actions for Message forms, and then shows how to create custom Reply To Folder actions for Post forms. Chapter 8, "Folders," takes an in-depth look at the folder design process, discusses how to make a folder available for offline use, and explains how to create custom views and folder home pages. It also covers setting folder permissions and building rules.

    Part IV Beyond the Basics

    Chapter 9, "Raise Events and Move to the Head of the Class," explains how you can use all the new events in the Outlook Object Model to write event-aware code in Outlook Visual Basic for Applications or an Outlook COM Add-In. Chapter 10, "The Outlook Development Environment," introduces the Outlook Script Editor for VBScript code behind Outlook forms. This chapter also discusses debugging with the Microsoft Script Editor and shows you the object models used in Outlook development. Chapter 11, "Using Visual Basic, VBA, or VBScript with Outlook," introduces VBScript and provides a wide variety of code examples for the most commonly performed tasks using VBScript or Visual Basic in Outlook. Chapter 12, "The Northwind Contact Management Application, " demonstrates how you can apply what you’ve learned so far in a reusable Customer Relationship Manangment (CRM) application designed for online and offline use. Chapter 13, "Distributing and Securing Applications," shows you how to distribute forms in folders and provides some techniques for maintaining and securing applications. This chapter also discusses the critical areas of Outlook Object Model and attachment security and illustrates how the Outlook E-Mail Security Update has been integrated into Outlook 2002. Finally, you’ll learn how your current and future applications can coexist with the Outlook E-Mail Security Update.

    Part V Advanced Topics

    The Advanced Topics chapters are primarily for developers who want to use Visual Basic to extend Outlook in a corporate environment where Exchange Server is installed. Chapter 14, "Creating COM Add-Ins with Visual Basic," provides you with practical templates for Visual Basic COM Add-in component creation and discusses the security issues associated with COM Add-ins. You’ll also learn how to use Visual Basic to create an ActiveX control that serves as a property page in the Outlook Tools Options dialog box. Chapter 15, "Integrating Outlook with Web Applications," shows you how to use the Outlook View Control in Web pages. You’ll also learn how to create Digital Dashboard Web Parts for the Northwind Contact Management Application. In Chapter 16, "Using Outlook with SharePoint Portal Server," you’ll discover how you can use the PKMCDO Object Model for document check in, check out, and versioning. You will be able to integrate the Northwind Contact Management application with SharePoint Portal Server document management and search.

    Sample Applications

    The sample application for this book is in the Building Microsoft Outlook 2002 Applications personal folders (.pst) file on the CD that accompanies this book. You can modify the sample Northwind Contact Management application for use in your organization. The Northwind Contact Management application is a CRM application created in Exchange public folders, and is suitable for both online and offline use. This application is extended in the Advanced Topics chapters of the book. You can integrate the Northwind Contact Management application with the Digital Dashboard Resource Kit 3.0 and with SharePoint Portal Server 2001 as shown in Figure I-1.

    Figure I.1 - The Northwind Portal Site integrates Outlook  with custom Web Parts and SharePoint Portal Server Document Management.

    System Requirements

    To run the code on the companion CD, you will need a computer that meets the following minimum requirements:

    • Pentium 133 or higher Pentium-compatible CPU
    • 32 megabytes (MB) of RAM or more, depending on the operating system, plus 8 MB of RAM per each open Office application
    • 650 MB hard disk or larger, depending on the operating system
    • CD-ROM drive
    • Super VGA (SVGA) monitor
    • Mouse or other pointing device (recommended)

    The following software must be installed on your system:

    • Windows NT 4.0, Windows 2000 Professional, or Windows 2000 Server or later
    • Microsoft Internet Explorer 5.01 or later (to view the electronic version of this book)
    • Microsoft Outlook 2002
    • Collaboration Data Objects 1.21

    To modify the sample applications, you will need the following software:

    • Microsoft Visual Basic 6 with Service Pack 3 or later
    • Microsoft Visual InterDev 6.0 with Service Pack 3 or later
    • Microsoft Office XP Developer

    To install the sample applications on Exchange Server:

    • Microsoft Exchange 5.5 Server or Microsoft Exchange 2000 Server

    To extend the sample applications:

    • Microsoft Digital Dashboard Resource Kit 3.0 or later
    • Microsoft SharePoint Portal Server 2001

    Using the Companion CD

    The companion CD contains all the code necessary to run the sample applications discussed in this book, including evaluation versions of several third-party tools, sample COM Add-Ins, Web Parts for use in Digital Dashboards or SharePoint Portal Server 2001, the Exchange SDK, and the SharePoint Portal Server SDK. It also includes a sample personal folders (.pst) file, which contains all of the applications and sample code covered in this book.

    You might want to make a copy of the applications and dissect the ones you’re most interested in to see how they’re developed. You can also customize these applications and put them to work in your organization.

    Run the Setup Program for Building Applications with Microsoft Outlook Version 2002

    The Setup program requires that you have already installed Microsoft Outlook 2002 on your computer. Microsoft Outlook 2002 is not included on the companion CD. You must install Microsoft Outlook 2002 before you proceed.

    To install the book's program files

    1. Insert the CD accompanying this book into your CD-ROM drive.
    2. If a menu screen does not launch automatically, double-click StartCD.exe in the root folder of the CD-ROM.
    3. Click Install Samples to start the Building Applications with Microsoft Outlook 2002 installation to your hard disk. A Welcome dialog box will appear.
    4. In the Welcome dialog box, click Next.
    5. In the Select Directory dialog box, select the folder where you will install the Building Microsoft Outlook Version 2002 Applications personal folders (.pst) file. Click the Browse button if you want to select an alternative folder.
    6. Click Next to begin the installation process.
    7. If Setup detects that you already have a VBAProject.otm file on your system, you will see an Alert message box that informs you that the VBAProject.otm accompanying this book has been renamed and the location of the renamed file. See "Installing VBAProject.otm" later in this Introduction if you see this alert message box during installation. Click OK to dismiss the VBAProject.otm Warning alert box if it appears during installation.
    8. Click Finish to complete the installation.

    Using the Building Microsoft Outlook 2002 Applications Personal Folder (.pst) File

    The Setup program installs a Building Microsoft Outlook 2002 Applications file in the destination folder you specified during installation and adds this file as a personal folders file to your current profile. The Building Microsoft Outlook 2002 Applications file is actually a personal folders (.pst) file that contains sample forms and files, links to technical articles and white papers, links to Microsoft Product Support Services Knowledge Base articles that pertain to Outlook development, and all the files necessary to run the sample applications and code examples.

    Although it’s not required that you add the Building Microsoft Outlook 2002 Applications file to your system, it serves as a valuable reference tool, and the sample applications can be used as a starting point for building applications that can be customized for your environment.

    Installing VBAProject.otm

    Outlook 2002 supports Visual Basic for Applications as an integral component of the Outlook application environment. All the code for Outlook Visual Basic for Applications is stored in a single file, VBAProject.otm. This file is stored in the locations in the following table depending upon operating system and whether user profiles are operational on your system. If your operating system is installed on a drive other than drive c:\, adjust the location accordingly.

    Operating System Location for VBAProject.otm
    Microsoft Windows 98 and Windows Me
    <drive>:\Windows\Application Data\Microsoft\ Outlook
    Microsoft Windows NT 4.0
    <drive>:\Winnt\Profiles\ <user>\Application Data\Microsoft\Outlook
    Windows 2000
    <drive>:\Documents and Settings\Profiles\ <user>\Application Data\Microsoft\Outlook

    If you already have a VBAProject.otm on your system, the installation program will display an alert message informing you that it has detected an existing VBAProject.otm. In this instance, the VBAProject.otm that accompanies this book will be renamed to VBABAO2K2.otm and copied to the location of your existing VBAProject.otm. For you to use the sample code in the VBAProject.otm that accompanies this book, you will have to rename your existing VBAProject.otm to a name such as MyVBAProject.otm and then rename VBBAO2K2.otm to VBAProject.otm. If you don’t have an existing VBAProject.otm, the VBAProject.otm that accompanies this book will be installed automatically and you can ignore the following steps.

    To install the VBAProject.otm accompanying this book if you already have VBAProject.otm installed on your Windows 2000 system

    1. If Outlook is running, quit Outlook by using the Exit command on the File menu. You must exit Outlook completely or you will receive a sharing violation when you attempt to rename VBAProject.otm.
    2. Click the Start button on the Windows Task bar, click Search, and click For Files Or Folders.
    3. Type vba*.otm in the Search For Files Or Folders Named drop-down combo box.
    4. Select Local Drives in the Look-In drop-down combo box.
    5. Make sure that the Include Subfolders box is checked.
    6. Click Find Now.
    7. When VBAProject.otm and VBABAO2K2.otm are found on your system, right-click VBAProject.otm and select Rename on the shortcut menu. Type MyVBAProject.otm as the new name, and press Enter.
    8. Right-click VBABAO2K2.otm, and select Rename on the shortcut menu. Type VBAProject.otm as the new name. Press Enter.
    9. Restart Outlook. The VBAProject.otm that accompanies this book is now the operational VBA Project for Outlook.

    The steps for other operating systems are similar. Simply locate the vba*.otm file on your system, rename it, and replace with the supplied file.

    Outlook Macro Security

    If Outlook Macro Security is set to High, the macros in VBAProject.otm will be disabled. In Outlook 2002, the default Outlook Macro Security setting is High. For the code in the VBAProject.otm file accompanying this book to run correctly, you must change the Outlook Macro Security setting to Low or Medium. Changing the setting to Low or Medium impacts only your ability to run the code in VBAProject.otm; it does not modify the built-in object model and attachment security mechanisms built into Outlook 2002.

    To change Outlook Security settings to Low or Medium

    1. Select Macro from the Tools menu.
    2. Select Security from the Macro submenu.
    3. Select the Low or Medium security option on the Security Level page.
    4. Click OK to accept your selection.
    Because Outlook Visual Basic for Applications code is loaded on demand, you must press Alt+F11 to open the Visual Basic Editor the first time you launch Outlook after you install the VBAProject.otm that accompanies this book. Once you press Alt+F11, you’ll see the Macro Warning dialog box. Select the Enable Macros button to run the code in VBAProject.otm.

    Installing Collaboration Data Objects

    Some of the code examples on the companion CD require the installation of Collaboration Data Objects (CDO) 1.21. CDO is not installed with the default Office XP setup. It is recommended that you install CDO before you run the code examples that are provided with this book.

    To install Collaboration Data Objects

    1. Insert the Office XP CD into your CD-ROM drive.
    2. Click Start, click Settings, and then click Control Panel.
    3. Double-click Add/Remove Programs.
    4. On the Install/Uninstall page, click Microsoft Office XP—the exact title will vary depending on the version of Office XP installed on your computer—and then click Add/Remove on Windows 2000 computers. On Windows 98, Windows Me, and Windows NT 4.0 computers, click Change.
    5. In the Microsoft Office XP Maintenance Mode dialog box, click Add Or Remove Features.
    6. Double-click the Microsoft Outlook For Windows item to expand the item in the Microsoft Office XP: Update Features dialog box.
    7. Click the Collaboration Data Objects item under Microsoft Outlook For Windows.
    8. Select Run From My Computer in the installation options drop-down.
    9. Click Update to complete the installation of Collaboration Data Objects.

    Technical Support for the Companion CD

    Every effort has been made to ensure the accuracy of this book and the contents of the companion CD. Microsoft Press provides corrections for books through the World Wide Web at the following address:

    http://mspress.microsoft.com/support/search.shtml

    If you have comments, questions, or ideas regarding this book or the companion CD, please mail or e-mail them to Microsoft Press at the following addresses:

    Postal Mail

    Microsoft Press
    Attn: Building Applications with Microsoft Outlook Version 2002 Editor
    One Microsoft Way
    Redmond, WA 98052-6399

    E-Mail

    mspinput@microsoft.com

    Please note that product support is not offered through the above mail addresses. For support information on Outlook, see the documentation for the appropriate product support phone number.

    [an error occurred while processing this directive]