Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPathname::GetEscapedElement method is used to escape special characters in the input pathname.
HRESULT IADsPathname::GetEscapedElement( LONG lnReserved, BSTR bstrInStr, BSTR bstrOutStr );
This method supports the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
This method is useful to handle pathname containing special characters in a unescaped string as input from a user interface. The input string must be a single element (name-value pair) of the path, that is, "CN=Smith,John".
The following Visual Basic® code snippet shows the effect produced by IADsPathname::GetEscapedElement.
Dim x As New Pathname rdn = x.GetEscapedElement(0, "cn=smith,john")
Now, rdn becomes "cn=smith\,john".
The following VBScript code snippet shows the effect produced by IADsPathname::GetEscapedElement.
Dim x Set x = CreateObject("Pathname") rdn = x.GetEscapedElement(0, "cn=smith,john")
Now, rdn becomes "cn=smith\,john".
The following C++ code snippet shows the effect produced by IADsPathname::GetEscapedElement.
LPWSTR adsPath=L"LDAP://server/cn=jsmith,dc=Microsoft,dc=com"; IADsPathname *pPath = GetPathnameObject(adsPath); BSTR rdn; HRESULT hr = pPath->GetEscapedElement(0,L"cn=smith,john",&rdn); pPath->Release();
Now rdn become "cn=smith\,john".
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Iads.h.