IADsContainer Method: Create

Create
(
 Class As String,
 RelativeName As String
) As IADs;

Parameters

[in] String Class
Class that is the name of an object in DirectScript, e.g., "User", "Group" or "Computer". Possible values are:

Computer Container

"User" and "Group"

Domain Container

"User", "Group" and "Computer"

File Container

"File", "Directory" and "Share". For "File" creates a zero length file

RegistryKey Container

"RegKey" and "RegValue"

[in] String RelativeName
Name of an actual object in the namespace, e.g., John is the RelativeName with Class "User".

Description
Creates the object identified by the provided class and relative name. It returns a pointer to the newly created object.

Return Values
Newly created ADs object.

Domain Container

IADsDomain

Computer Container

IADsComputer

File Container

IFile

RegistryKey Container

IRegistryKey

Example

Dim UserContainer As IADsContainer
Dim User As IADsUser
Set UserContainer = GetObject("NTDS://YourDomainName")
Set User = UserContainer.Create("User", "NewUserName")
Debug.Print User.ADsPath

'This example creates a new directory
Dim FileContainer As IADsContainer
Dim Directory As Ifile
'Get IADsContainer for the documents directory
Set FileContainer = GetObject("NTDS://DomainName/MachineName/file_services/c-drive/documents")
'Create a new directory under documents and get its IFile interface
Set Directory = FileContainer.Create("Directory", "NewDirectory")

 

See Also