This is a follow up to our documentation on PR_AB_CHOOSE_DIRECTORY_AUTOMATICALLY. There, we discussed how Outlook 2010 has a property which can override the container specified in SetDefaultDir. Today, we’re going to override SetSearchPath. Let’s look at our dialog again:
That list of address books under Custom is what we set using SetSearchPath. How can we set “Start with Global Address List” or “Start with contact folders”? There’s a prop for that: PR_AB_SEARCH_PATH_CUSTOMIZATION, which you’ll find in the same place as PR_AB_CHOOSE_DIRECTORY_AUTOMATICALLY, on the profile section IID_CAPONE_PROF.
Here's the property definition:
#define PR_AB_SEARCH_PATH_CUSTOMIZATION( PT_LONG, 0x3D1B)
Here are the valid settings:
typedef enum _SearchPathReorderType { SEARCHPATHREORDERTYPE_RAW = 0, SEARCHPATHREORDERTYPE_ACCT_PREFERGAL, SEARCHPATHREORDERTYPE_ACCT_PREFERCONTACTS, } SearchPathReorderType;
typedef enum _SearchPathReorderType
{
SEARCHPATHREORDERTYPE_RAW = 0,
SEARCHPATHREORDERTYPE_ACCT_PREFERGAL,
SEARCHPATHREORDERTYPE_ACCT_PREFERCONTACTS,
} SearchPathReorderType;
Finally, here's a description of each of the settings:
Persisted search Path: Contacts A GAL A GAL B GAL C Contacts D Contacts D2 Contacts C Contacts B
Reordered Search Path sending from B with this option: GAL B Contacts B GAL A Contacts A GAL C Contacts C Contacts D Contacts D2
Reordered Search Path sending from B with this option: Contacts B GAL B Contacts A GAL A Contacts C GAL C Contacts D Contacts D2
Enjoy!
Angela just posted an article on extending Outlook on her blog, and an article on picking the right API on the MSDN. Both articles make several mentions of MFCMAPI and are thus worthwhile reads. The MSDN article is an especially good one-stop overview of all the APIs and technologies available in Outlook, with special attention paid to details such as managed vs unmanaged code, bitness, and threading
Note that both articles are written very much from Outlook’s point of view. The presumption is that Outlook is part of your solution. This may not necessarily be the case. If you are considering server side solutions, your top choices will likely be either Exchange Web Services (EWS) or the MAPI download, though there several other Exchange based APIs which you can read about in the Exchange Server 2010 SDK.
The April 2011 Release (build 7.0.0.1234) is live: http://mfcmapi.codeplex.com.
I know I just released the March update a few days ago, but I just got permission from development to release this. I have thrown off the shackles of C++ and fully embraced the awesome power of the CLR. MFCMAPI.NET is a complete rewrite of MFCMAPI using the .Net framework.
The productivity gains were immediate. I was able to completely rewrite MFCMAPI, from scratch, in just 20 minutes. Since I had allotted a full hour for the conversion, I spent the extra time adding some new features, such as:
Even after implementing those amazing features, I still had a half hour left, so I decided to fix a few other outstanding issues for the Outlook and Exchange product teams. Look for announcements soon of the following hotfixes:
All in all, it was a super productive 45 minutes coding with .Net. I even had time for a nap! I look forward to doing it again.
Enjoy.