A Description About the Use of Characters in Templates in Microsoft Metadirectory Services (288924)



The information in this article applies to:

  • Microsoft Metadirectory Services 2.1
  • Microsoft Metadirectory Services 2.2

This article was previously published under Q288924

SUMMARY

This article describes the use of characters in templates in Microsoft Metadirectory Services.

MORE INFORMATION

The templates in Microsoft Metadirectory Services use characters that are defined in the Management Agent (MA) template definition. If a character is already defined in the template definition, that character can be used only for its defined purpose. However, you can use the reserved characters in the user-defined constants (in the MA template definition) in your templates.

An example of a problem:

Company XYZ needs to construct an Exchange display name in the form of LastName, FirstName (Department). The following code, however, does not work because the open and close brackets () are already reserved by the default MA template definition:
$v_displayName = $mv.sn, $mv.givenName ($mv.department)
				
An example of a resolution to the problem:

Add the user-defined constants to the MA template definition for the open and close bracket characters. The code lines can resemble:
c_openBracket	code:40
c_closeBracket	code:41
				
These constant names can now be used in place of the brackets in a Microsoft Metadirectory Services template. The template code can resemble:
$v_displayName = ($mv.sn)(, $mv.givenName) $c_openBracket$mv.department$c_closeBracket
				
As an example, assume that you have a metaverse object with the following attribute values:

givenName = Joe
sn = Smith
department = Sales

The previous code can produce the following string and place it in the $v_displayName variable:

Smith, Joe (Sales)

The other scenarios that can require the use of user-defined constants are:
  • When you populate an Exchange secondary address with SMTP$.
  • When you test for either carriage return (CR) or line feed (LF) in the attribute values.

How to Determine Character Codes

The Charmap.exe program can be used to determine the ASCII code of a character. From the list of fonts, select the system font. When you view the code in the Charmap.exe program, the code value is displayed in hexadecimal format. However, the value must be converted to decimal format before the value can be used in the MA template definition. To convert a value from hexadecimal to decimal format, use the Calc.exe tool in Scientific mode.

More information is available in the "User-Defined Constants" section in Appendix C of the Microsoft Metadirectory Services Management Agent Toolkit Manual.

Modification Type:MinorLast Reviewed:1/25/2006
Keywords:kbinfo KB288924