Export (0) Print
Expand All

IDirectoryObject::DeleteDSObject method

The IDirectoryObject::DeleteDSObject method deletes a leaf object in a directory tree.

Syntax


HRESULT DeleteDSObject(
  LPWSTR pszRDNName
);

Parameters

pszRDNName

The relative distinguished name (relative path) of the object to be deleted.

Return value

This method returns the standard return values, including S_OK for a successful operation. For more information and other return values, see ADSI Error Codes.

Remarks

To delete a container object and its children, use the IADsDeleteOps::DeleteObject method.

Examples

The following C/C++ code example shows how to delete a user object.


HRESULT hr;
IDirectoryObject *pDirObject=NULL;
hr = ADsGetObject(L"LDAP://OU=Sales,DC=Fabrikam,DC=com",
    IID_IDirectoryObject, (void**) &pDirObject );
 
if ( SUCCEEDED(hr) )
{
    hr = pDirObject->DeleteDSObject( L"CN=Jeff Smith" );

    pDirObject->Release();
} 


Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Iads.h

DLL

Activeds.dll

IID

IID_IDirectoryObject is defined as E798DE2C-22E4-11D0-84FE-00C04FD8D503

See also

IDirectoryObject
IADsDeleteOps::DeleteObject
ADSI Error Codes

 

 

Show:
© 2014 Microsoft