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:
Add a layout to the Directory, Schema.
Return a count of the objects in the collection.
Select the object from the collection.
Gives the total number of NWLayoutDescription objects.
object.Count
Long.
Read-only.
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
Initializes the collection for the enumeration of all the NWLayoutDescription objects.
object.Reset()
None.
Void.
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
Gets the next NWLayoutDescription object.
object.Next()
None.
NWLayoutDescription.
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
Determines whether or not any more NWLayoutDescription objects exist in the collection.
object.HasMoreElements()
None.
Boolean.
Returns TRUE, if the collection contains some more NWLayoutDescription objects.
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
Returns the NWLayoutDescription object for the specified index.
object.Element(
Index As Variant)
Index can be either numeric or string. String index represents the name of NWLayoutDescription object.
NWLayoutDescription.
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
Returns the NWLayoutDescription object for the specified index.
object.Item(
Index As Variant)
Index can be either numeric or string. String index represents the name of NWLayoutDescription object.
NWLayoutDescription.
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
Adds a new element to the NDS Schema.
object.AddElement(
Layoutname As String),
(BaseLayout As String)[,
(MandatoryFields As String)[,
(ContainmentLayouts As String)[,
(NamingFields As String[[[)
Name of the new layout.
Layout from which the new layout inherits the fields.
An array of strings containing the names of the mandatory fields for this new layout.
Layouts under which the objects of new layout can be created.
Fields that can be used for naming the object of this layout.
NWLayoutDescription.
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
Adds a new layout to the NDS Schema.
object.Add(
LayoutName As String),
(BaseLayout As String),
(MandatoryFields As String[]),
(ContainmentLayouts As String[]),
(NamingFields As String[])
Name of the new layout.
Layout from which the new layout inherits the fields.
An array of strings containing the names of the mandatory fields for this new layout.
Layouts under which the objects of new layout can be created.
Fields that can be used for naming the object of this layout.
NWLayoutDescription.
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
Removes the user-defined layout from the NDS Schema.
object.RemoveElement(
LayoutName As String)
Name of the layout to be removed.
Boolean.
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
Removes the user-defined layout from the NDS Schema.
object.Remove(
LayoutName As String)
Name of the layout to be removed.
Boolean.
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