Directory Services |
The IADsDeleteOps::DeleteObject method deletes an ADSI object.
HRESULT DeleteObject( Long lnFlags );
This method supports the standard return values, including S_OK for a successful operation. For more information about error codes, see ADSI Error Codes.
The following Visual BasicĀ® code shows how to delete an object and its children.
Dim cont As IADsContainer Dim ops As IADsDeleteOps Set cont = GetObject("LDAP://OU=sales,DC=Fabrikam,DC=com") Set ops = cont ops.DeleteObject (0)
The following C++ code shows how to delete an object and its children.
IADsContainer *pCont; LPWSTR adsPath = L"LDAP://OU=Sales,DC=Fabrikam,DC=com"; HRESULT hr = ADsGetObject(adsPath, IID_IADsContainer, (void**)&pCont); if (FAILED(hr)) exit(hr); IADsDeleteOps *pOps; hr = pCont->QueryInterface(IID_IADsDeleteOps,(void**)&pOps); pCont->Release(); if(FAILED(hr) exit(hr); pOps->DeleteObject(0); pOps-Release();
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.
Access Control and Object Deletion, ADSI Error Codes, IADsContainer::Delete, IADsDeleteOps, IADsDeleteOps Interface, IDirectoryObject::DeleteDSObject