SetSearchPath? Not Really

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:

Address Book Tools Options Dialog

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;

Finally, here's a description of each of the settings:

  • SEARCHPATHREORDERTYPE_RAW:

    Return a list of the containers that are in the persisted MAPI search path. This is the "Custom" search path option in the UI.

  • SEARCHPATHREORDERTYPE_ACCT_PREFERGAL:

    Group the search path based on the mail accounts in the profile, prefer the given sending account, and within each account, prefer the GAL. An example reordering here sending from account B would be the following:

    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

  • SEARCHPATHREORDERTYPE_ACCT_PREFERCONTACTS

    Group the search path based on the mail accounts in the profile, prefer the given sending account, and within each account, prefer that account's contacts folders. An example reordering here sending from account B would be the following:

    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:

    Contacts B

    GAL B

    Contacts A

    GAL A

    Contacts C

    GAL C

    Contacts D

    Contacts D2

Enjoy!