11.7 FoldersCollection

A collection of all folder object containers with in a folder object.

For Web-based scripts, the number of entries depends on the user rights.

11.7.1 Count property

Returns the number of items in a collection object.

Syntax

 object.Count
 

Type

Long.

Attributes

Read-only.

Example

See sample in Example.

11.7.2 Add method

Adds a new Folder to a Folders collection.

Syntax

 object.Add(
    FolderName As String)
 

Parameters

FolderName
The name of the new Folder being added.

Return Values

Section 11.5, Folder.

Remarks

If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.

Example

See sample in Example.

11.7.3 HasMoreElements method

Returns TRUE if there is any folder in FoldersCollection (HasMoreElements method).

Syntax

 object.HasMoreElements
 

Parameters

None.

Return Values

Boolean.

Example

See sample in Example.

11.7.4 Item method

Returns an item based on the specified FolderName.

Syntax

 object.Item(
    FolderName As String)
 

Parameters

FolderName
Name of the folder that is being returned.

Return Values

Section 11.5, Folder.

Example

See sample in Example.

11.7.5 Next method

Returns the next folder object from the FoldersCollection. If there are no more folders in the collection, it returns NULL.

Syntax

 object.Next
 

Parameters

None.

Return Values

Section 11.5, Folder.

Example

See sample in Example.

11.7.6 Reset method

Resets the collection of the folder in the FoldersCollection object.

Syntax

 object.Reset
 

Parameters

None.

Return Values

Void.

Example

This example adds a folder to the collection and retrives the attributes of all the folders available in that collection. It also gives the creation date of a specific folder in that collection.

 <% Set FSO = CreateObject("Scripting.FileSystemObject")
 Set Folder = FSO.GetFolder ("Sys:\nsn\user")
 Set folders = Folder.subfolders
 
 ’Adds a folder to the collection
 Response.Write Folders.Add("Test")
 Response.Write Folders.Count %>
 
 <% ’Resets the collection
 Folders.Reset()
 
 ’Checks for folders in the collection
 Do While Folders.HasMoreElements()
    For each folder in Folders
      Response.Write Folder.Name
    Next
 
 ’Sets the pointer to the next folder in the collection
  Folders.Next()
 Loop %>
 
 <% ’Sets the object to a specified folder
 Set Folder = Folders.Item ("Test")
 
 ’Returns the creation date of the folder sample
 Response.Write Folder.DateCreated %>