Directory Services

ADS_ESCAPE_MODE_ENUM

The ADS_ESCAPE_MODE_ENUM enumeration specifies how escape characters are displayed in a directory path name.

typedef enum 
{
  ADS_ESCAPEDMODE_DEFAULT = 1, 
  ADS_ESCAPEDMODE_ON = 2, 
  ADS_ESCAPEDMODE_OFF = 3, 
  ADS_ESCAPEDMODE_OFF_EX = 4
} ADS_ESCAPE_MODE_ENUM;

Values

ADS_ESCAPEDMODE_DEFAULT
The default escape mode provides a convenient option for specifying the escape mode. It has the effect of minimal escape operation appropriate for a chosen format. Thus, the default behavior depends on the value that ADS_FORMAT_ENUM uses to retrieve the directory paths.
Retrieved Path Format Default Escaped Mode
ADS_FORMAT_X500 ADS_ESCAPEDMODE_ON
ADS_FORMAT_X500_NO_SERVER ADS_ESCAPEDMODE_ON
ADS_FORMAT_WINDOWS ADS_ESCAPEDMODE_ON
ADS_FORMAT_WINDOWS_NO_SERVER ADS_ESCAPEDMODE_ON
ADS_FORMAT_X500_DN ADS_ESCAPEDMODE_OFF
ADS_FORMAT_X500_PARENT ADS_ESCAPEDMODE_OFF
ADS_FORMAT_WINDOWS_DN ADS_ESCAPEDMODE_OFF
ADS_FORMAT_WINDOWS_PARENT ADS_ESCAPEDMODE_OFF
ADS_FORMAT_LEAF ADS_ESCAPEDMODE_ON
ADS_ESCAPEDMODE_ON
All special characters display in the escape format; for example, "CN=date\=yy\/mm\/dd\,weekday" displays as is.
ADS_ESCAPEDMODE_OFF
ADSI special characters display in the unescaped format; for example, "CN=date\=yy\/mm\/dd\,weekday" displays as "CN=date\=yy/mm/dd\,weekday".
ADS_ESCAPEDMODE_OFF_EX
ADSI and LDAP special characters display in the unescaped format; for example, "CN=date\=yy\/mm\/dd\,weekday" displays as "CN=date=yy/mm/dd,weekday".

Remarks

Special characters must be escaped when used for any unintended purposes. For example, LDAP special characters, the comma (,) and the equal sign (=), are intended as field separators in a distinguished name, "CN=user,CN=users,DC=Fabrikam,DC=com". When an attribute value uses such special characters, for example, "CN=users\,last name\=Smith", these special characters must be escaped as shown. This ensures that an LDAP-compliant directory, such as Active Directory, will parse the path properly. However, an escaped path string may not appear to be user-friendly on a display. In this case, you can set the ADS_ESCAPE_MODE_ENUM in such way that shows the path as an unescaped string, "CN=users,last name=Smith".

Similarly, the ADSI special character, slash mark (/), separates ADSI-specific elements, "LDAP://server/CN=Jeff Smith,CN=Users,DC=Fabrikam,DC=com". Although it must be escaped when used for any other purposes, for example, "LDAP://server/CN=Jeff Smith\/California,CN=Users,DC=Fabrikam,DC=com". You can choose an ADS_ESCAPE_MODE_ENUM option to display this escaped string in a human-readable form: "LDAP://server/CN=Jeff Smith/California,CN=Users,DC=Fabrikam,DC=com".

Presently, the slash mark (/) is the only ADSI special character. LDAP special characters are defined in the LDAP specifications. ADSI escaping/unescaping applies to ADSI special characters only. The operation will not affect any LDAP special characters, that is, they are neither escaped nor unescaped.

To show unescaped path string, use the IADsPathname interface and its methods. All other ADSI APIs return the escaped path string.

Note  Because VBScript cannot read data from a type library, VBScript applications do not recognize symbolic, as constants defined above. Instead, use the numerical constants instead to set the appropriate flags in your VBScript applications. To use the symbolic constants, make explicit declarations of such constants, as done here, in your VBScript application.

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

ADSI Enumerations, ADS_FORMAT_ENUM, IADsPathname