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:
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.