Directory Services |
The IADsPathname::GetEscapedElement method is used to escape special characters in the input path.
HRESULT GetEscapedElement( long lnReserved, BSTR bstrInStr, BSTR* bstrOutStr );
This method supports the standard return values, as well as the following:
For more information and other return values, see ADSI Error Codes.
Return Code | Description |
---|---|
S_OK | The operation is successful. |
E_FAIL | The operation has failed. |
E_NOTIMPL | The method is not supported for this particular provider. |
This method is used to handle a path that contains 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,Jeff".
The following Visual Basic code example shows the effect produced by IADsPathname::GetEscapedElement.
Dim x As New Pathname rdn = x.GetEscapedElement(0, "cn=smith,jeff")
Now, rdn becomes "cn=smith\,jeff".
The following VBScript code example shows the effect produced by IADsPathname::GetEscapedElement.
Dim x Set x = CreateObject("Pathname") rdn = x.GetEscapedElement(0, "cn=smith,jeff")
Now, rdn becomes "cn=smith\,jeff".
The following C++ code example shows the effect produced by IADsPathname::GetEscapedElement.
LPWSTR adsPath=L"LDAP://server/cn=jeffsmith,dc=Fabrikam,dc=com"; IADsPathname *pPath = GetPathnameObject(adsPath); BSTR rdn; HRESULT hr = pPath->GetEscapedElement(0,CComBSTR("cn=smith,jeff"),&rdn); pPath->Release();
Now rdn become "cn=smith\,jeff".
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.