Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPathname::RemoveLeafElement method removes the last element from the directory path that has been set on the Pathname object.
HRESULT IADsPathname::RemoveLeafElement();
This method supports the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
The following Visual Basic® code snippet 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 snippet 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 snippet shows the effect produced by calling the IADsPathname::RemoveLeafElement.
LPWSTR adsPath=L"LDAP://server/cn=jsmith,dc=Microsoft,dc=com"; IADsPathname *pPath = GetPathnameObject(adsPath); HRESULT hr = pPath->RemoveLeafElement(); pPath->Release();
Now the pathname becomes "LDAP://server/dc=Microsoft,dc=com".
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.