Click here to Skip to main content
11,428,221 members (61,239 online)
Click here to Skip to main content

Outlook Interop, Including Distribution Lists

, 2 Mar 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
Re-usable code to manage Outlook.

Introduction

Apparently, the DLLs for interop with Outlook have changed through the years. After unsuccessfully trying literally hundreds of articles while searching for online-submitted source code for Outlook interop (even the documentation on MSDN was quite confusing), I decided to create my own code.

The submitted, zipped, working code provided is very terse, fairly easy to understand, and is even easier to employ. The code worked well on an older IBM laptop with the XP-Pro Operating System and Office 2003.

Using the code

To re-use the code, use the ofOutlook.h and ofOutlook.cpp files in your Visual Studio project. Then, simply use an include directive, such as demonstrated in the (Form1.h) file, then add the methods that you would like to have in your form... or even in command-line/non-GUI programs.

The files are very small, once unzipped. A snippet from one of the files follows:

// A snippet from ofOutlook.h containing the initial declarations that 
// will identify the locations necessary for the Microsoft DLL to work.
//
private:
   static Outlook::ApplicationClass^ myOutlook = gcnew Outlook::ApplicationClass();
   static Outlook::NameSpace^ myNs = myOutlook->GetNamespace("MAPI");
   static Outlook::MAPIFolder^ folderContacts = 
          myNs->GetDefaultFolder(Outlook::OlDefaultFolders::olFolderContacts);

Points of interest

This code was functional as of early December's upgrades to XP and Office 2003. But your mileage may vary - YMMV (for Europeans, your consumption may vary).

History

This is the original article.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ralph in Boise
Web Developer
United States United States
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150428.2 | Last Updated 2 Mar 2009
Article Copyright 2009 by Ralph in Boise
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid