4.8 NWLayoutDescriptions Collection

The NWLayoutDescriptions collection represents a set of NWLayoutDescription objects in the NDS Schema. The collection allows you to add, delete, count, and access layouts (object classes) in the Directory.

Use this object to:

4.8.1 Object Diagram

Describes the hierarchy of various objects in NWLayoutDescriptions object

4.8.2 Count property

Gives the total number of NWLayoutDescription objects.

Syntax

object.Count

Type

Long.

Attributes

Read-only.

Example

This example returns the number of Layout objects in NDS.

Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User","Password")
Set Layouts = nwdir.Layouts()
Print "Total number of Layouts in this schema: "&Layouts.Count

4.8.3 Reset method

Initializes the collection for the enumeration of all the NWLayoutDescription objects.

Syntax

object.Reset()

Parameters

None.

Return Values

Void.

Example

This example resets the count of Layout objects in NDS.

Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts
Layouts.Reset()
Print "Total number of Layouts in this schema: "&Layouts.Count
While Layouts.HasMoreElements()
    Set Layout = Layouts.Next()
    Print Layout.Name
Wend

4.8.4 Next method

Gets the next NWLayoutDescription object.

Syntax

object.Next()

Parameters

None.

Return Values

NWLayoutDescription.

Example

This example shows how to get the next NWLayoutDescription object.

Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts
Layouts.Reset()
Print "Total number of Layouts in this schema: "&Layouts.Count
While Layouts.HasMoreElements()
    Set Layout = Layouts.Next()
    Print Layout.Name
Wend

4.8.5 HasMoreElements method

Determines whether or not any more NWLayoutDescription objects exist in the collection.

Syntax

object.HasMoreElements()

Parameters

None.

Return Values

Boolean.

Remarks

Returns TRUE, if the collection contains some more NWLayoutDescription objects.

Example

This example shows whether there are any more objects in the collection

Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts()
Layouts.Reset()
Print "Total number of Layouts in this schema: "&Layouts.Count
While Layouts.HasMoreElements()
    Set Layout = Layouts.Next()
    Print Layout.Name
Wend

4.8.6 Element method

Returns the NWLayoutDescription object for the specified index.

Syntax

object.Element(
  Index As Variant)

Parameters

Index

Index can be either numeric or string. String index represents the name of NWLayoutDescription object.

Return Values

NWLayoutDescription.

Example

This example returns the specified NWLayoutDescription object.

Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts()
Layouts.Reset()
Print "Total number of Layouts in this schema: "&Layouts.Count
While Layouts.HasMoreElements()
    Set Layout = Layouts.Next()
    Print Layout.Name
Wend
’ Search for user layout
Set UserLayout = Layouts.Element ("User")
    Print UserLayout.Name

4.8.7 Item method

Returns the NWLayoutDescription object for the specified index.

Syntax

object.Item(
  Index As Variant)

Parameters

Index

Index can be either numeric or string. String index represents the name of NWLayoutDescription object.

Return Values

NWLayoutDescription.

Example

This example returns the specified NWLayoutDescription object.

Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts()
Layouts.Reset()
Print "Total number of Layouts in this schema: "&Layouts.Count
While Layouts.HasMoreElements()
    Set Layout = Layouts.Next()
    Print Layout.Name
Wend
’ Search for user layout
Set UserLayout = Layouts.Item ("User")
Print UserLayout.Name

4.8.8 AddElement method

Adds a new element to the NDS Schema.

Syntax

object.AddElement(
  Layoutname As String),
  (BaseLayout As String)[,
  (MandatoryFields As String)[,
  (ContainmentLayouts As String)[,
  (NamingFields As String[[[)

Parameters

LayoutName

Name of the new layout.

BaseLayout

Layout from which the new layout inherits the fields.

MandatoryFields

An array of strings containing the names of the mandatory fields for this new layout.

ContainmentLayouts

Layouts under which the objects of new layout can be created.

NamingFields

Fields that can be used for naming the object of this layout.

Return Values

NWLayoutDescription.

Example

This example shows how to add a new element into the NDS schema.

Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login "User", "Password"
’ Build required parameters
MandatoryFields = Array("CN")
ContainmentLayouts = Array("Organization", "Organizational Unit")
NamingFields = Array("CN")
LayoutName = "NSN Layout"
’ Create a new Layout
nwdir.Layouts.AddElement (LayoutName, "Top", MandatoryFields, ContainmentLayouts, NamingFields)
  If (Err.Number = 0) Then
    Print "New Layout Created Succesfully"
Else
    Print "Failed to Create New Layout"
End If

4.8.9 Add method

Adds a new layout to the NDS Schema.

Syntax

object.Add(
  LayoutName As String),
  (BaseLayout As String),
  (MandatoryFields As String[]),
  (ContainmentLayouts As String[]),
  (NamingFields As String[])
  

Parameters

LayoutName

Name of the new layout.

BaseLayout

Layout from which the new layout inherits the fields.

MandatoryFields

An array of strings containing the names of the mandatory fields for this new layout.

ContainmentLayouts

Layouts under which the objects of new layout can be created.

NamingFields

Fields that can be used for naming the object of this layout.

Return Values

NWLayoutDescription.

Example

This example shows how to add a new element into the NDS schema.

Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
’ Build required parameters
MandatoryFields = Array("CN")
ContainmentLayouts = Array("Organization", "Organizational Unit")
NamingFields = Array("CN")
LayoutName = "NSN Layout"
’Create a new Layout
nwdir.Layouts.Add (LayoutName, "Top", MandatoryFields, ContainmentLayouts, NamingFields)
  If (Err.Number = 0) Then
    Print "New Layout Created Succesfully"
Else
    Print "Failed to Create New Layout"
End If

See Also

Remove method

4.8.10 RemoveElement method

Removes the user-defined layout from the NDS Schema.

Syntax

object.RemoveElement(
  LayoutName As String)

Parameters

LayoutName

Name of the layout to be removed.

Return Values

Boolean.

Example

This example shows how to remove a Layout from the NDS Schema.

Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts
LayoutName = "NSN Layout"
If Layouts.RemoveElement(LayoutName) Then
    Print "Successfully removed the Layout"
Else
    Print "Failed to remove the Layout"
End If

4.8.11 Remove method

Removes the user-defined layout from the NDS Schema.

Syntax

object.Remove(
  LayoutName As String)

Parameters

LayoutName

Name of the layout to be removed.

Return Values

Boolean.

Example

This example shows how to remove a Layout from the NDS Schema.

Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts
LayoutName = "NSN Layout"
If Layouts.Remove(LayoutName) Then
    Print "Successfully removed the Layout"
Else
    Print "Failed to remove the Layout"
End If

See Also

Add method