Platform SDK: Active Directory, ADSI, and Directory Services |
The IDirectoryObject::DeleteDSObject method deletes a leaf object in a directory tree.
HRESULT DeleteDSObject( LPWSTR pszRDNName );
This method returns the standard return values, including S_OK for a successful operation. For other return values, see ADSI Error Codes.
To delete a container object and its children, use the IADsDeleteOps::DeleteObject method.
The following C/C++ code snippet shows how to delete a user object.
HRESULT hr; IDirectoryObject *pDirObject=NULL; hr = ADsGetObject(L"LDAP://OU=Sales,DC=Microsoft,DC=com", IID_IDirectoryObject, (void**) &pDirObject ); if ( SUCCEEDED(hr) ) { hr = pDirObject->DeleteDSObject( L"CN=Neil Smith" ); } pDirObject->Release();
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.
IDirectoryObject, IADsDeleteOps::DeleteObject, ADSI Error Codes