IADsPathname::GetEscapedElement method (iads.h)

The IADsPathname::GetEscapedElement method is used to escape special characters in the input path.

Syntax

HRESULT GetEscapedElement(
  [in]  long lnReserved,
  [in]  BSTR bstrInStr,
  [out] BSTR *pbstrOutStr
);

Parameters

[in] lnReserved

Reserved for future use.

[in] bstrInStr

An input string.

[out] pbstrOutStr

An output string.

Return value

This method supports the standard return values, as well as the following:

For more information and other return values, see ADSI Error Codes.

Remarks

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".

Examples

The following Visual Basic code example shows the effect produced by IADsPathname::GetEscapedElement. After this code is executed, rdn will contain "cn=smith,jeff".

Dim x As New Pathname
 
rdn = x.GetEscapedElement(0, "cn=smith,jeff")

The following VBScript code example shows the effect produced by IADsPathname::GetEscapedElement. After this code is executed, rdn will contain "cn=smith,jeff".

Dim x 
Set x = CreateObject("Pathname")
rdn = x.GetEscapedElement(0, "cn=smith,jeff")

The following C++ code example shows the effect produced by IADsPathname::GetEscapedElement. After this code is executed, rdn will contain "cn=smith,jeff".

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();

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header iads.h
DLL Activeds.dll

See also

ADSI Error Codes

IADsPathname