Directory Services |
The IADsPathname::RemoveLeafElement method removes the last element from the directory path that has been set on the Pathname object.
HRESULT RemoveLeafElement();
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. |
The following Visual Basic code example shows the effect produced by calling this method.
Dim x As New Pathname x.Set "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL x.RemoveLeafElement ' now x is "LDAP://srv1/dc=company,dc=com".
The following VBScript code example shows the effect produced by calling this method.
Dim x Const ADS_SETTYPE_FULL =1 Set x = CreateObject("Pathname") x.Set "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL x.RemoveLeafElement ' now x is "LDAP://srv1/dc=company,dc=com".
The following C++ code example shows the effect produced by calling IADsPathname::RemoveLeafElement.
LPWSTR adsPath=L"LDAP://server/cn=jeffsmith,dc=Fabrikam,dc=com"; IADsPathname *pPath = GetPathnameObject(adsPath); HRESULT hr = pPath->RemoveLeafElement(); pPath->Release();
Now the pathname becomes "LDAP://server/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.