"This is the 'must have' book for programming with Outlook and CDO. This book provides the details, tips, and cautions that can save you time and frustration when building collaborative applications. So if you like 'the best' in your technical library, get this book." --Deborah Kurata, InStep Technologies, Inc.
Written for IT developers who build collaborative and workflow applications, this book provides a comprehensive reference to working with Microsoft's powerful collaborative development environment, including Outlook 2000, Exchange Server, Visual Basic, and the Collaboration Data Objects (CDO) Library. It demonstrates ways in which these technologies can be tied together into effective business solutions--from small-scale groupware to large-scale enterprise-wide systems.
Developing Applications using Outlook 2000, CDO, Exchange, and Visual Basic offers an overview of the Microsoft collaborative landscape, and then examines each element of that environment in detail. Numerous examples showcase the applications made possible with these technologies and demonstrate VBScript coding techniques. You will find in-depth information on such important topics as:
In addition, this book shows how a number of outside technologies can extend the capabilities of the Outlook/Exchange development environment, including Active Directory (ADSI) services, SQL Server, and ActiveX Data Objects (ADO). The examples include approving purchase order reports using Exchange, maintaining a corporate directory using Outlook and SQL Server, and building an eCommerce application with Exchange and SQL Server.
A comprehensive supporting Web site, including sample code and Visual Basic project files, can be found at http://www.MMAnet.com/OutlookExchange.
I. GETTING STARTED.= 1. Overview of the Collaboration and Communication Architecture.
Introduction to Collaborative Systems.
Collaboration Data Objects.
Using Outlook versus CDO.
Microsoft Exchange Server.
Overview of MAPI.
Other Collaboration Components.
How the Pieces Fit Together.
II. MICROSOFT OUTLOOK 2000.= 2. Outlook Forms and VBScript.
Overview of Outlook Forms.
Putting Code behind an Outlook Form.
Saving Outlook Forms.
Accessing Forms through Code.
Overview of Forms/VBScript Limitations.
Changing Forms for Existing Items.
Tips for Outlook Forms/VBScript Development.
Displaying Information: Views.
Summary.3. The Outlook 2000 Object Model.
The Object Model.
User Interface Objects.
Accessing Outlook Data.
Additional Outlook Development Features.
Accessing the Mail Control Panel in Code.
Integration with Microsoft Access.
Conclusion.4. MailItems and PostItems.
MailItem and PostItem Properties.
MailItem and PostItem Methods.
MailItem and PostItem Events.
Summary.5. AppointmentItems and TaskItems.
The Outlook Calendar: Appointments and Meetings.
How AppointmentItems and MeetingItems Work Together.
Creating Custom Appointment Forms.
The Outlook Tasks List: TaskItems.
How TaskItems Work.
Summary.6. Contacts and Distribution Lists.
Contacts, Recipients, and AddressEntries.
The Recipient Object.
Distribution List Items.
Summary.7. VBA, COM Add-Ins, and Custom Property Pages.
Visual Basic for Applications.
The COMAddIns Collection.
Using COM Add-Ins to Implement Property Pages.
III. COLLABORATION DATA OBJECTS AND EXCHANGE.8. Microsoft Exchange Server.
Exchange's Core Components.
Other Exchange Services.
Setting Up Exchange.
Exchange Administrator Program.
Configuring Mailboxes and Public Folders.
Summary.9. Collaboration Data Objects.
What CDO Provides.
The CDO Objects.
At the Top: The Session Object.
The InfoStores Collection.
Folders and the Folder Object.
Messages and the Message Object.
Discussion Group Support.
The Address Book Objects.
The AddressEntry Object.
CDO for NT Server.
CDO for Windows 2000.
CDO for Exchange Platinum.
Summary.10. Accessing Exchange Using the Web.
Outlook Web Access.
The Frameset Design-Time Control.
The HTML Form Converter.
Exchange Web Example.
The CDO Rendering Library.
Server Location Considerations.
Web Access Performance.
Summary.11. Exchange Agents.
Uses for Exchange Agent Scripts.
Behind the Scenes.
Example of Exchange Agent Calling a COM Component.
Creating an Agent.
Installing an Agent.
Under the Hood.
Conclusion.12. Exchange Server Routing Objects.
Using Routing Objects for Workflow.
Architecture of Routing Objects.
The Routing Engine.
The Routing Wizard.
Routing Objects Object Model.
Process Map Actions.
Creating the Process Map.
Tips and Caveats for Successful Routing.
IV. MISCELLANEOUS TOPICS.13. Outlook or CDO: Deciding Which to Use.
Okay, So Which One Do I Use?
The Object Model Structures.
Comparison of the Two Models.
Summary.14. Using Active Directory Services Interfaces with Microsoft Exchange.
The Lightweight Directory Access Protocol.
The Object Schema.
The ADSI Object Model.
ActiveX Data Objects.
Example: Changing Employee Information.
Conclusion.15. Data Access Technologies: ActiveX Data Objects and OLE DB.
The Exchange and Outlook Message Stores.
Universal Data Access.
Using ADO to Read Contacts from a Database.
Accessing Data with an Exchange OLE DB Provider.
Summary.16. Site Server and Knowledge Management.
Exchange and Site Server.
Site Server Implementing Index Server.
Using Site Server to Index Data.
Working with Catalogs.
Site Server Configuration and Administration.
The MSSearch.Query Search Object.
Conclusion.17. Using Microsoft Transaction Server with Exchange Agents.
Overview of Microsoft Transaction Server.
HOW MTS Relates to Exchange.
Installing and Implementing MTS.
V. SAMPLE APPLICATIONS.18. The CdoExplorer Application.
Overview of the Application.
A Look at the Code.
Building the Folder Tree.
Summary.19. A Group Scheduling Application.
Description of the Business Problem.
Create a Custom Outlook Form.
Publish the Form to the Organizational Forms Library.
Creating the Visual Basic Application.
Putting It All Together.
Summary.20. An Outlook Calendar Viewer Application.
Description of the Business Problem.
Detailed Code Highlights.
Conclusion.21. A Purchase Order Application Using Routing Objects.
Description of the Business Problem.
Architecture of the Application.
Summary.22. A Corporate Directory Maintenance Application.
Description of the Business Problem.
The Application in Action.
Initializing the EntryIDs.
Updating the Address Book.
Viewing Updated Properties.
Putting It All Together.
Summary.23. An eCommerce Workflow Application.
A Closer Look at the eCommerce Application.
Behind the Scenes: the Code.
When a brokerage house approached us to design an Outlook 97 application for its prospect management system, Office 97 was still in alpha testing; the client was what Microsoft calls an "early adopter." The early adopter program was developed to help corporations migrate to the newest technology available. Translated: They already had Microsoft Office 97 in its earliest possible release, as well as the backing of Microsoft priority support.
The client was a Microsoft Enterprise customer that recognized the benefit of leveraging its investment in Office 97. Prior to our arrival, it had already researched more than a dozen sales force automation products. It decided that Outlook was the way to go.
A large obstacle during development was how to create a form that contained 425 fields. We don't think that the folks at Microsoft ever dreamed that someone would try to build a form with so many fields. Microsoft supported us the whole way. And it corrected some minor issues for the beta version; we never had to redo a form from scratch, because the beta version was compatible with the alpha version. It's not often that you come across a development tool that is so stable in alpha. Microsoft took time to develop Outlook well before releasing it and ultimately distributed a tool worthy of building business applications.
The latest version, Outlook 2000, is the most developer-friendly of all versions. Microsoft also enhanced the programmability features of Exchange Server (Exchange) to include workflow and routing features. Outlook is so versatile that you can build a groupware solution in a matter of hours. Moreover, you can use Outlook and Exchange as components for a large-scale enterprise system. This book will help you to do all of this.
This section describes the evolution of messaging and collaboration products available from Microsoft and other vendors. Figure 1 shows the evolution of Exchange and Outlook in particular.
Most mail systems prior to the release of Microsoft Exchange and Lotus v3.0 depended very much on the client machine. The result was slow response time and the risk of losing mail messages.
Microsoft Mail was based on a shared file messaging system. Initially, it lacked a form development tool. Microsoft added the Electronic Forms Designer to facilitate form development, thereby allowing you to create forms using 16-bit Visual Basic (VB).
Lotus was the first company to introduce a collaborative platform. It designed its Notes product to perform most of the mail processing on the server. This allowed clients to use as many powerful servers as necessary to get the job done. Notes was also designed to allow groups or departments to work better together. Lotus not only got the client server mail system boom going; it also coined the term groupware. When IBM purchased Lotus, it acquired the ability to bundle Notes with hardware and other systems.
Microsoft spent many hours in design sessions listening to large enterprise customers in order to understand what they liked about Lotus Notes. It identified features that were missing in Microsoft Mail and sought to make Exchange the market's most reliable messaging and collaboration solution.
Microsoft wanted to ensure that current customers could gradually migrate to Exchange from their existing mail systems. Lotus Notes, Lotus ccMail, Novell's GroupWise, and even mainframe mail systems such as PROFS and SYSM can be easily migrated to Exchange. The process that it uses for migration is fairly simple. If the migrating client has a cc:Mail system, it simply uses Exchange cc:Mail migration tools, which allow Exchange to emulate cc:Mail and thereby allow the cc:Mail clients to believe that they are still communicating with an existing cc:Mail installation. This type of integration allows Exchange and any of the other mail systems to run in tandem.
After Microsoft had the messaging part of Exchange working, it began to think about collaboration. Collaboration applications prior to Exchange were mostly written in Lotus Notes, VB, or other development tools. Word from within Lotus was that the company wanted to build a tool that would function on a Windows desktop. The new tool would be a desktop information manager that would allow the user to work all the time from within this application. Around the same time, Microsoft went to the drawing board and created Outlook. Today, Outlook, a strong collaboration client, and Exchange, a strong messaging server, form a powerful team that facilitates messaging and collaboration requirements for applications worldwide.
This book features key development tips for the Notes developer who needs to develop applications in Outlook and Exchange. While the two development environments share many of the same concepts, they have key differences that we note throughout the book.
This book is divided into five parts.
Part I, Getting Started: Contains an overview of current technologies and of installation recommendations for the software needed to use the sample applications in this book.
Part II, Microsoft Outlook 2000: Discusses the Outlook 2000, as well as Outlook 97 and 98, development environments. This part illustrates concepts at a high level, drills down to demonstrate techniques using code samples, and provides a thorough reference for the object model.
Part III, Collaboration Data Objects and Exchange: Covers Exchange Server, the Collaboration Data Objects (CDO) library, and Active Serve Pages (ASP)/Exchange applications and introduces event scripting and Routing Objects.
Part IV, Miscellaneous Topics: Discusses additional applications and techniques that can be used with Exchange and Outlook to enhance and extend their functionality. This part builds on the core chapters of Parts 2 and 3.
Part V, Sample Applications: Offers a selection of examples that are featured at the book's Web site, reviewed step-by-step and with various coding techniques highlighted.
In addition, chapters that contain sample applications include a Tech Check section, which instructs you on which platforms and applications need to be installed and whether specific permissions and security are needed.
The site (http://www.mmanet.com/OutlookExchange) contains information in a format that resembles this book's format. It includes a downloadable zip file with folders that match the chapters in the book. Each folder that contains code includes a
readme.txt file that lists the contents of the chapter.
Two additional zip files contain Visual MAPI, a shareware application that gives you the ability to see code mapped to different CDO functions, and the CdoExplorer, which allows you to examine folders, items, and properties (we discuss CdoExplorer in Chapter 18).
This book was written for several types of readers. The primary intended reader is the application developer. Administrators and IT managers, also, should find the book helpful. It uses VB as its primary language for its examples, so you will find it helpful to be familiar with that programming language. However, code that runs in an Outlook form or on an ASP must be written in VBScript. Most VB code can be easily used with little or no modification in applications written in Visual Basic for Applications (VBA) and with some modification in VBScript.
The second intended reader of this book is the technical developer with a business vision. It drills down to the code level so that you can solve problems, as well as describes and demonstrates the practical uses that you might have for the code.
We also want it to be a great reference book--the one we wished we'd had when we started developing Outlook and Exchange applications. It is very frustrating to see a fellow VB developer who needs to generate an internal e-mail from the company's Web site carrying around the C++ MAPI book or a book on TCP/IP sockets. Outlook and Exchange development is fairly new. We wanted to educate developers on the power of using this extensive and often misunderstood development environment.
Note: We recommend that you use a test Exchange Server when developing your applications and deploy them only when fully tested.
We hope that this book is as useful to you as it was informative for us to write.
A huge thanks to the primary editor of the book, Erica Jamison. Her expertise helped make this book as good as it could be. Without Erica's guidance and patience, there would be no book. Thanks to the technical editing team, with special thanks to Darrique Barton, Martin Tirion, and Doug Wood for their amazing dedication to improving the technical details in the book.
We would also like to thank Diane Bush, Dan Kasun, Robert Ginsberg, Steve Peschka, Jim Reitz, and Tom Rizzo for their help for various sections of the book.
We would like to express heartfelt thanks to J. Carter Shanklin, Krysia Bebick, Michael Slaughter, Laura Michaels, and the entire Addison Wesley team, who gave us the opportunity to write this book.
We are also very grateful to our colleagues at MMA, whose expertise and support are a constant reminder of why we enjoy building solutions. Their feedback and insight shaped much of this book.
Raffaele: I would like to thank my wife, Jackie, and my two daughters, Lauryn and Marissa, for supporting me and being patient with my crazy schedule. Also for assisting with editing I would like to thank Candace Valvano.
Scott: I would like to send thanks to Erica for putting up with my late nights and all-weekend-long work schedules, to Mauro Cardarelli, Andy Kawa, and Alex Gomez for putting the book through real-world testing, and to the MCP team. Thanks to the foosball gang (you know who you are) for your patience, input, and much-needed breaks.