SetLocaleIDs Method (Session Object)

Topic Last Modified: 2004-06-09

The SetLocaleIDs method sets identifiers that define a messaging users locale.

objSession.SetLocaleIDs(LocaleID, CodePageID)


Required. This Session object.


Required. Long. The locale identifier (LCID) to be used for this messaging user.


Required. Long. The code page identifier to be used for this messaging user.

A locale is the set of features of a messaging users environment that are dependent on language, country/region, culture, and conventions. These features include the character selection, the collating sequence and sort order, and the date, time, and currency formats. The SetLocaleIDs method sets identifiers that determine the behavior of locale-sensitive operations.

A locale identifier (LCID) is a 32-bit value containing a 16-bit language identifier and a 4-bit sort identifier. The Microsoft® Windows NT® macros SORTIDFROMLCID and LANGIDFROMLCID can be used to extract these identifiers from the LCID.

A code page identifier is a long integer specifying the ordered character set to use when displaying text. Information about a code page can be obtained from the Windows NT GetCPInfo function.

The SetLocaleIDs method does not affect the locale or code page of any rendering object. The RenderingApplication object exposes the CodePage property to select the character representation and the LCID property to identify the collating sequence, the sort order, and the formats for time, date, and currency representation. Similarly, the ContainerRenderer provides a CodePage property and an LCID property, and the ObjectRenderer object exposes its own CodePage and LCID.

If SetLocaleIDs is to be called, it must be called before the Session objects Logon method is called. This allows the messaging users profile to be set for the appropriate locale. A call to SetLocaleIDs following logon returns CdoE_CALL_FAILED.

Note that the SetLocaleIDs method is the sole exception to the rule that a call to a sessions Logon method must precede any other access to that session.

SetLocaleIDs tests the validity of the code page specified by the CodePageID parameter before actually setting the locale identifiers. If the code page is not valid, CdoE_INVALID_ARGUMENT is returned.

The LocaleID and CodePageID parameters correspond to the Microsoft Exchange properties PR_LOCALE_ID and PR_CODE_PAGE_ID.