Directory Services |
The IADsPathname::AddLeafElement method adds an element to the end of the directory path already set on the Pathname object.
HRESULT AddLeafElement( BSTR bstrLeafElement );
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 succeeded. |
E_FAIL | The operation failed. |
E_ADS_BAD_PATHNAME | The path set is not supported by this retrieval format. |
E_INVALIDARG | The user has supplied an invalid dwFormatType parameter. |
The following Visual Basic code example adds the "com" element to "dc=dom,dc=company".
Dim x As New Pathname x.Set "LDAP://srv1/dc=dom,dc=company", ADS_SETTYPE_FULL x.AddLeafElement("dc=com")
The following VBScript code example adds the "com" element to "dc=dom,dc=company".
Dim x Const ADS_SETTYPE_FULL = 1 Set x = CreateObject("Pathname") x.Set "LDAP://srv1/dc=dom,dc=company", ADS_SETTYPE_FULL x.AddLeafElement("dc=com")
The following C++ code example shows the effect produced by calling the IADsPathname::AddLeafElement.
LPWSTR adsPath=L"LDAP://server/dc=Fabrikam,dc=com"; IADsPathname *pPath = GetPathnameObject(adsPath); HRESULT hr = pPath->AddLeafElement(CComBSTR("cn=jeffsmith")); pPath->Release();
The pathname is converted to "LDAP://server/cn=jeffsmith,dc=Fabrikam,dc=com".
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.