Click here to Skip to main content
Licence CPOL
First Posted 2 Mar 2009
Views 7,851
Downloads 100
Bookmarked 12 times

Outlook Interop, Including Distribution Lists

By | 2 Mar 2009 | Article
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)

About the Author

Ralph in Boise

Web Developer

United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 2 Mar 2009
Article Copyright 2009 by Ralph in Boise
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid