Last modified: April 19, 2011

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Establishes the specified container as the default address book container.

HRESULT SetDefaultDir(
  ULONG cbEntryID,


[in] The byte count in the entry identifier pointed to by the lpEntryID parameter.


[in] A pointer to the entry identifier of the default address book container.


The default address book container was successfully set.

Clients and service providers call the SetDefaultDir method to establish a new default address book container. The default container is the container that the user sees displayed in the address book when the address book is first opened. SetDefaultDir saves the default container as an entry in the profile. The container remains as the default until either another call to SetDefaultDir is made in the same session or in another session, or the container is removed.

Note Note

The PR_AB_CHOOSE_DIRECTORY_AUTOMATICALLY property corresponds to the Choose automatically setting in the Address Book Options dialog. When this property exists in the IID_CAPONE_PROF profile section and is set to true, the Address Book dialog no longer defaults to the container specified by SetDefaultDir, but chooses an address book that Microsoft Outlook considers appropriate for the context in which the dialog was displayed. Note that this may result in a poor experience for third-party address book providers.

For MFCMAPI sample code, see the following table.






MFCMAPI uses the SetDefaultDir method to make the specified address book container the default one.