SetLocaleIDs Method (CDONTS Session Object)

The SetLocaleIDs method sets identifiers that define a messaging user's locale.

Syntax

objSession.SetLocaleIDs(CodePageID) 
 
objSession
Required. The Session object.
CodePageID
Required. Long. The code page identifier to be used for this messaging user.

Remarks

A locale is the set of features of a messaging user's environment that are dependent on language, country, 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 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.

Before SetLocaleIDs is called, the locale and code page are set to the values in the user's registry.

If SetLocaleIDs is to be called, it must be called before the Session object's LogonSMTP method is called. This allows the messaging user's 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 session's LogonSMTP method must precede any other access to that session.

Every new message you create within the current session uses the locale established by your most recent call to the Session object's SetLocaleIDs method, or the default settings if you have never called SetLocaleIDs. A Message object created by the Messages collection's Add method cannot subsequently change its locale, even if SetLocaleIDs is called again. However, you can change a NewMail object's locale after its creation by calling the NewMail object's SetLocaleIDs method. Such a call does not affect the locale of any other Message or NewMail object, nor does it alter the settings established by the Session object's SetLocaleIDs method.

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_PARAMETER is returned.