Platform SDK: Active Directory, ADSI, and Directory Services

Deleting a Mailbox Object

This example demonstrates how to delete a mailbox object (organizationalPerson). To delete a different type of object, simply replace organizationalPerson with the class of the object to be deleted.

Dim objCont As IADsContainer
Set objCont = GetObject(strContPath) 'Bind to the Container
ObjCont.Delete "organizationalPerson", "cn=Username"
ObjCont.SetInfo
Set objCont = Nothing

Note: This example is specific to Exchange Server version 5.5 and below, and is not upwardly compatible with Exchange 6.0. Management and access of Exchange 6.0 Servers should be made through the CDO Exchange Management interfaces instead.