Lost Website

You Are Here

Microsoft has 2 contact management API which you shouldn’t use

with 2 comments

This day has not improved the problems I have with developing on Microsoft Windows. I was doing some research for future development of the Echotracker. I was looking at how to access the Windows address book features through an API and found there are only 3 options open to the programmer wanting to access address book features on Windows.

The main API we use to deal with Microsoft Outlook 200x, the Outlook Object Model (OOM), offers no ways to directly access the address book provided by Outlook. This is bad enough by itself because it means that access to the address book must be done through the dreaded, and unsupported with .NET, MAPI.

Microsoft Windows XP, and probably some earlier version, also had the Windows Address Book API. This is a COM API that give access to the default Windows address book.

This API is deprecated and Microsoft explicitly says that programmers should not use it.

New applications should not use these interfaces. These interfaces exist for backward compatibility with legacy applications. These interfaces will be unavailable in the future.

The newer, Windows Vista and up, alternative is the Windows Contacts API, but here is what Microsoft has to say about this API.

New applications should not use these interfaces. These interfaces exist for backward compatibility with legacy applications. These interfaces will be unavailable in the future.

So Microsoft deprecated the old API, which isn’t necessarily unreasonable, but replaced it with an API that they ask programmers not to use. Of course, they don’t provide any of alternative nor rationale for that message.

So where does that leave us? Nowhere. Programmers who wants to use the Windows address book features will use those APIs, deprecated or not and screw around until it works. Technical analyst taking project decision could also say that Windows has no contact management API. I’m not sure which path Microsoft wants people to take regarding that. I’m lost myself.

Written by François-Denis Gonthier

March 18th, 2010 at 2:53 pm

2 Responses to 'Microsoft has 2 contact management API which you shouldn’t use'

Subscribe to comments with RSS or TrackBack to 'Microsoft has 2 contact management API which you shouldn’t use'.

  1. Unless I am mistaken, it seemed possible to recover contacts directly from the OOM, by coding something like this:
    # Outlook.Application app = new Outlook.ApplicationClass();
    # Outlook.NameSpace ns = app.GetNamespace(“MAPI” );
    # Outlook.MAPIFolder folder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
    # Outlook.Items contacts = folder.Items;

    Anyway, I totally agree that this requires interop. and it is really frustrating. It seems that in Redmond, no one imagines the user managing conctacts without an exchange server …pouah.

    Cyril Pineau

    29 Apr 10 at 3:39 am

  2. Wow! You are probably right I did not realize you could open the address book just like any other special folder. I was somehow expecting a specific API for contacts. Thank you for that information.

    Sadly, I will no longer work on Microsoft Outlook in the near (hopefully far) future so I can’t test this or use this myself.

    François-Denis Gonthier

    29 Apr 10 at 7:37 am

Leave a Reply