This is the primary interface for all Container Objects. You can
use this interface to create, delete, copy, move, and enumerate
contained objects. All container objects (listed above) support
this interface. For example, you can create a Domain in the
NameSpace object. Similarly, you can create a Computer, User or a
Group in a Domain object, or create Local Groups and Local Users in
a Computer.
Creates a new object in a container identical to a
specified object and returns a pointer to the new object. Copying
objects across namespaces is not permitted
Creates a new user in a container identical to the
specified user and returns a pointer to the new user. It also
copies the user with permissions intact for only one File
Creates a new user in a container identical to the
specified user and returns a pointer to the new user. The user is
copied with permissions intact for all files in the entire network.
This method does not support the Computer object
Creates a new user in a container identical to the
specified user and returns a pointer to the new user. The user is
copied with permissions intact for only specified ShareNames. This
method does not support the Computer object
Gets or sets the filter on the object classes that
will be returned in a given enumeration. This property must be set
for Domain, Computer, File and RegistryKey Containers and is not
required for the NameSpace Container
Returns the IADs interface of the item in the
container identified by the object's class and relative name (this
is the value of the object's IADs::Name property)
Moves a given object from a given source to a
container. Note that this method is currently not supported for all
objects
Example
This example helps you use IADsContainer to enumerate Group Objects
in Container Objects like NameSpace, Domain, or Computer. Here the
Container Object is a Computer.
Dim Group As IADsGroup
Dim ComputerContainer As IADsContainer
'Bind to the known NT Computer object and get a Container Interface
on the Computer Object.
'Fill in the correct values for <DomainName> and
<ComputerName>
Set ComputerContainer = GetObject("NTDS://
<DomainName>/<ComputerName>")
'Set the filter to "Group" for enumerating local groups in the
computer.
ComputerContainer.Filter = "Group"
'Print the Count of groups in the specified computer.
Debug.Print ComputerContainer.Count
'Enumerate the groups in computer and print their Name and
Description.
'Groups in a computer are local groups
For Each Group in ComputerContainer
Debug.Print Group.Name
Debug.Print Group.Description
Next Group