Learn how to extend Microsoft Office Outlook 2007 with this comprehensive reference. Complete with code samples in Microsoft Visual Basic\xae and Visual C#\xae, this guide delivers the information that developers need to create customized solutions.
Foreword
Hello, my name is Brian, and Im a developer. Now, you may wonder, is that a problem? Actually, it is. You see, if an application provides an object model, I will code it. Ever since I started programming on Windows, Ive been attracted to applications that expose their features via a programmatic application programming interface (API), allowing me to make them my own. Each release of Microsoft Outlookfrom the first release in 1996 to the newest release in 2007has provided ways for me and you to customize and extend, to make it our own.
While early releases of Outlook provided extensibility via VBScript, C++ extensions, and automation, it was Outlook 2000 that sparked a hot and heavy relationship that Ive maintained to this day. Outlook 2000 let me write in-process add-ins using my component technology and programming language of choice: COM and Visual Basic. Reading the documentation on how to write an add-in brought joy to my heart. All I had to do was implement a COM interface, IDTExtensibility2, and I could bring the power of component-based solutions to Outlook. I had the power to do just about anything I wanted. With the ability to bind my code to Outlook via its rich set of events or via user interface (UI) elements such as command bars, I could create compelling applications on top of Outlook for myself and customers. I was excited.
I proceeded to write articles, speak at conferences, and tinker. I got involved with creating digital dashboards where I was able to mix COM, Visual Basic, VBScript, DHTML, and the Outlook View Control to provide information displays consolidating local and remote information for quick and efficient review. It was at one of these conferencesin either the desert of Arizona or the sweltering heat of an Atlanta summerthat I met Randy Byrne. I had picked up Randys first edition of the book you hold in your hands, and I was looking forward to meeting him. I found his writing style pleasant, and the golden nuggets of insight in how to build applications on top of Outlook always made my solutions better. What was great about meeting Randy was that he was just as friendly as his writing made him out to besomething a bit unusual for a technical subject like programming. Talking with Randy about Outlook was always pleasant, and it never seemed to bother him when I asked what was either a simple question or something I had missed on page 562 of his book.
Randy updated the book for Outlook 2002, and I got my copy. Updated with essential information, such as how to deal with the new object model guard released in the wake of viruses like Melissa , I once again was indebted to Randy for taking the time to make the long journey that is writing a book. And, as in the past, whenever Id run into Randy at shows, like Microsofts annual technical show Tech Ed, wed exchange pleasantries, chat, and of course have the occasional discussion about Outlook.
As Outlook matured, programming options changed. Microsoft released the Common Language Runtime and the .NET Framework, Visual Basic .NET, and Visual C#. This new generation of development technologies sparked a new revolution and interest in programming the Windows platform. The increases in productivity that the new languages brought and the deep richness of the Frameworks class libraries made it easy to leave the world of COM behind for the managed world. However, applications built upon COM cant be rewritten overnight. Thus, if you wanted to work with Outlook, you still needed to deal with COM. From the managed world, that means knowing COM and .NET. You need to understand the impact of two different memory models and the cost of marshaling between two call stacks.
Outlook 2003 proved a less significant update than previous versions for developers. This led Randy and other authors to forgo writing updated and new versions of their books. But Randy wasnt just relaxing. He founded Micro Eye, Inc., to provide Outlook consulting services as well as popular add-ins like ZipOut. But something wonderful happened. Randy joined Microsoft as a Program Manager on the Outlook team. My heart filled with joy. With "one of us" on the inside, Outlook could only get better for developers like me (after all, its always about me). And get better it has.
Outlook 2007 is the most significant release of the product to date. While many will cite features such as the Ribbon, application task panes, and form regions as great new features, Im most happy with the unification of the programming model and a better Outlook object model guard. Since early betas, Ive poked and prodded at Outlook 2007 to see what I could do. No longer do I need to drop down to CDO or use third-party libraries to get around issues in the object model or runtime. Its a great way to work. However, dont get me wrongIm a sucker for shiny and new. The new Ribbon, I have to say, is just darn pretty and, once you get used to it, very functional. Naturally, I want to get my solutions using the Ribbon. In addition, form regions remove issues Ive had for years when working with the built-in Outlook forms. Issues in the past that often had me eschew them completely and instead rely upon other form technologies such as Windows Forms.
Yet, I have to admit, I have stumbled. Some of the new features of Outlook 2007 have forced me to think a bit harder than normal. And that is why I was elated to find out that Randy was updating "the book" for Outlook 2007. Better yet, he enlisted a cohort on the Outlook team to be his coauthor. I had read Ryan Greggs blog and MSDN articles, and I knew Randy had made a great decision. As I read my draft copy of their book, I didnt want to put it down. For one thing, Randy and Ryan have written this book for me. Okaynot just for me, but for you and me, the managed developer. Providing examples in both C# and Visual Basic for download, they take you on a journey, exploring what Outlook 2007 has to offer you. More importantly, they provide insight into why you should do things for performance and safety. In addition, because both of them are on the team, you know they write with firsthand knowledge and authority. This book is for those of you who want to write the best Outlook 2007 solutions.
On a trip to Redmond this fall, they asked me to write the foreword. I was not only honored but eager. After all, I knew without a doubt that this would be the book I would immediately acquire once published. I knew it would be the book I would recommend without hesitation. And here you have it. You hold the book on programming Outlook 2007 for managed developers. Im sure I might have something to say about Outlook 2007 at a conference or in an article, but I know I wont be writing a book. Theres no need. Now close the cover and get to the register. Youve got solutions to build.
Brian A. Randell
Upland, California
January 2007
Acknowledgments
A very large cast was required to produce Microsoft Office Outlook 2007. As Program Managers on the product team, we first want to thank all the Outlook team members who worked constantly to define, create, and test their individual features. For many of these improvements in Outlook 2007, the platform team was able to provide an object model to expose the feature to the developer community. Without the hard work of the feature teams, the platform would be diminished.