4.4 NWEntry Object

Each entry in the NDS tree is identified as a NWEntry object. The object returns the layout, field types, and other characteristics of an entry, and lets you modify the password and field values.

4.4.1 Object Diagram

Describes the hierarchy of various objects in NWEntry object

4.4.2 FullName property

Gives the full name of the object.

Syntax

object.FullName

Type

String.

Attributes

Read-write.

Example

This example returns the full name of the context.

Set nwdir = CreateObject ("UCX:NWDIR")
’enter the username and password
nwdir.Login ("user","password")
’enter the full name of the entry to be 
Set Entry = Nwdir.FindEntry("NDS:\\ACMEcorporation\Sales\TestUser")    Print "The full name of the entry is: "&Entry.FullName
Print "The short name of the entry is: "&Entry.ShortName      

4.4.3 ShortName property

Gives the short name of the object.

Syntax

object.ShortName

Type

String.

Attributes

Read-only.

Example

This example gives the short name of the current object.

Set nwdir = CreateObject ("UCX:NWDIR")
’enter the username and password
nwdir.Login ("user","Password")
’enter the full name of the entry to be 
Set Entry = Nwdir.FindEntry("NDS:\\ACMEcorporation\Sales\TestUser")    Print "The full name of the entry is: "&Entry.FullName
Print "The short name of the entry is: "&Entry.ShortName      

4.4.4 Layout property

Returns the Layout to which this object belongs.

Syntax

object.Layout

Type

NWLayoutDescription.

Attributes

Read-only.

Example

This example lists all the layouts and the details of each NDS layout.

Set nwdir = CreateObject ("UCX:NWDIR")
’Enter the user name and password
nwdir.Login ("user", "password")
’Enter the fullname of the entry
Set Entry =
nwdir.FindEntry("nds:\\ACMEcorporation\Sales\newyork")
Print "The full name of the entry is: "&Entry.FullName
Print "The short name of the entry is: "&Entry.ShortName 
Print "The entry belongs to the layout"&Entry.Layout.Name     

4.4.5 ModifyDate property

Gives the last modification date.

Syntax

object.ModifyDate

Type

Date.

Attributes

Read-only.

Example

This example prints the modification date for each entry in NDS.

Set dirObj = CreateObject("UCX:NWDIR")
’Enter the username and password
dirObj.Login ("user","password")
dirObj.FullName = "NDS:\\ACMEcorporation\Sales\Newyork"
Set Entry = dirObj.Entry
Print "This entry was last modified on: "&Entry.ModifyDate

4.4.6 PartitionRoot property

Indicates whether the object is a partition root.

Syntax

object.PartitionRoot

Type

Boolean.

Attributes

Read-only.

Example

This example shows how to find whether a given entry is in the root partition.

Set dirObj = CreateObject("UCX:NWDIR")
’Enter the username and password
dirObj.Login("User","password")
dirObj.FullName="NDS\\ACMEcorp\Sales\Newyork"
Set Entry = dirObj.Entry
Print "The entry is a partition root" &Entry.PartitionRoot

4.4.7 Alias property

Indicates whether the object is an alias.

Syntax

object.Alias

Type

Boolean.

Attributes

Read-only.

Example

This example indicates whether the entry is an alias.

Set dirObj = CreateObject("UCX:NWDIR")
’Enter the user name and password
dirObj.Login("user","password")
dirObj.FullName="NDS:\\ACMEcorp\Sales\newyork"
Set Entry = dirObj.Entry
Alias = Entry.Alias
If (Alias = TRUE) Then 
  Print "The Entry object is an Alias"
Else
   Print "The Entry object is not an Alias"
Endif

4.4.8 Container property

Indicates whether the entry is a container object.

Syntax

object.Container

Type

Boolean.

Attributes

Read-only.

Example

This example indicates whether the entry is a Container object.

Set dirObj = CreateObject("UCX:NWDIR")
dirObj.Login("user", "password")
dirObj.FullName="NDS:\\ACMEcorp\Sales\Newyork"
Set Entry = dirObj.Entry
Container = Entry.Container
If (Container = TRUE) Then
    Print "The Entry object is a Container"
Else
    Print "The Entry object is not a Container"
Endif

4.4.9 Entries property

Returns a collection of entry objects, if this entry object is a container object.

Syntax

object.Entries

Type

NWEntries.

Attributes

Read-only.

Example

This example lists the entries in NDS with its FullName, ShortName and the date it was last modified.

Set dirObj = CreateObject("UCX:NWDIR")
dirObj.Login("user", "password")
Set Entry = dirObj.Entries
Print "The number of entries: "&entry.Count
For each entry in dirobj.Entries
    Print "The full name is " &Entry.FullName
    Print "The short name is "&Entry.ShortName
    Print "The entry was modified on "&Entry.ModifyDate
Next

4.4.10 GetPartitionRoot method

Gets the partition root node of the object.

Syntax

object.GetPartitionRoot()

Parameters

None.

Return Values

NWEntry.

Example

This example gives the partition of the specified object.

Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user","password")
Set Entry=nwdir.FindEntry ("NDS:\\Acmecorp\Sales\Newyork")
’Get the partition root node in which this entry resides
Set partition = Entry.GetPartitionRoot()
Print "The short name of the partition: "&partition.shortname

See Also

FindEntry method

4.4.11 SetPassword method

Changes the password.

Syntax

object.SetPassword(
  NewPassword As String,
  [OldPassword As String])

Parameters

NewPassword

The new password of the entry.

OldPassword

The previous password of the entry.

Return Values

Boolean.

Example

This example shows how to change a password.

On Error Resume Next
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user", "password")
Set Entry=nwdir.FindEntry ("nds:\\Acmecorp\Sales\manager")
’Set the object’s password
If (Entry.SetPassword ("newpassword", "oldpassword")) Then
   Print "The password is changed sucessfully"
Else
   Print "Unable to change the password"
Endif

4.4.12 VerifyPassword method

Verifies the password.

Syntax

object.VerifyPassword(
  Password As String)

Parameters

Password

The password being passed in to be compared with the current password of the object.

Return Values

Boolean.

Remarks

Returns true if the password is correct; otherwise, returns false.

Example

This example shows how to verify an object's password.

On Error Resume Next
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user","password")
Set Entry=nwdir.FindEntry ("nds:\\Acmecorp\Sales\Manager")
’Set the object’s password
If (Entry.SetPassword ("new password","oldpassword")) Then
   Print "The password is changed sucessfully"
Else
   Print "Unable to change the password"
Endif
If (Entry.VerifyPassword ("new password")) Then
    Print "Password Verification Success"
Else 
    Print "Password Verification Failed"
End If

4.4.13 GetFieldValue method

Returns the value of the field.

Syntax

object.GetFieldValue(
  FieldName As String,
  [ForceAsArray As Boolean])

Parameters

FieldName

Name of the field for which you want the value, for example: "Surname."

ForceAsArray

Default value is FALSE.

Return Values

Variant.

Remarks

If ForceAsArray is true, then the result will always be an array of values. For single-valued attributes, the result is an array of one value.

If there exists no value for the attribute, then this method sets an error and returns false.

  • For simple data types like boolean, the data integer is returned in the respective equivalent UCS form.

  • For complex types the return value is a UCS object; the property names of the object are same as the names of the structure members of the equivalent NDS syntax structure. For example: NWACL, NWEMailAddress, NWPostalAddress, NWTypedName, NWPath, NWNetAddress, NWOctetString. These are same as the equivalent ActiveX types.

    NDS Syntax Type

    UCX Object Name

    Properties

    SYN_UNKNOWN

    UCX:NWDIR.NWUNKNOWN

    String Name

    Long ID

    Long Value

    SYN_NET_ADDRESS

    UCX:NWDIR.NWNETADDRESS

    Long Type

    String Address.

    SYN_PATH

    UCX:NWDIR.NWPATH

    Long Type

    String Volume

    String Path

    SYN_REPLICA_POINTER

    UCX:NWDIR.NWREPLICA-POINTER

    String ServerName

    Long Type

    Long Number

    Long Count

    NetAddress Address

    SYN_OBJECT_ACL

    UCX:NWDIR.NWACL

    String Attribute

    String Subject

    Long Privileges

    SYN_BACK_LINK

    UCX:NWDIR.NWBACKLINK

    String ObjectName

    Long ID

    SYN_HOLD

    UCX:NWDIR.NWHOLD

    String ObjectName

    Long Amount

    SYN_TIMESTAMP

    UCX:NWDIR.NWTIMESTAMP

    Date Time

    Long Event

    SYN_TYPED_NAME

    UCX:NWDIR.NWTYPEDNAME

    String ObjectName

    Long Level

    Long Interval

    SYN_CI_LIST

    Array

     

    SYN_OCTET_LIST

    Array

     

    SYN_PO_ADDRESS

    Array

     

  • For multi-valued attributes, the values are returned in an array.

Example

This example gets the value of the Surname.

Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user", "password")
Set Entry=nwdir.FindEntry ("NDS:\\Acmecorp\Sales\Manager")
Surname=Entry.GetFieldValue ("Surname")
Print "Surname of " &Entry.Shortname &" is: "&Surname

4.4.14 SetFieldValue method

Changes the value of the attribute.

Syntax

object.SetFieldValue(
  FieldName As String,
  Value As Variant,
  [PreviousValue As Variant]) 

Parameters

FieldName

Name of the desired field.

Value

The field value to be set.

PreviousValue

The previous value of the field.

Return Values

Boolean.

Remarks

For multi-valued attributes, each value and its previous value has to be passed in separate calls to setFieldValue. For example, to replace 5 member names of a group with 5 new names, setFieldvalue has to be called five times.

Example

This example shows how to modify the value of an attribute; here the Surname.

Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Entry=nwdir.FindEntry ("NDS:\\AcmeCorp\Sales\Newyork")
’Modify the Surname
Entry.SetFieldValue ("Surname","New Surname","Old Surname")
’Commit the changes
Entry.Update()

4.4.15 LoadFieldValueFromFile method

Changes the value of the attributes having NDS syntax stream.

Syntax

object.LoadFieldValueFromFile(
  FieldName As String,
  FileName As String)

Parameters

FieldName

Name of the field to be set.

FileName

File name from which to retrieve value from and set field to.

Return Values

Boolean.

Remarks

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

Example

This example shows how to update the changed attribute value to a file.

Set nwdir=createobject("UCX:NWDIR")
nwdir.Login ("admin", "password")
Set entry=nwdir.Findentry ("NDS:\\Acmecorp\Sales\TestUser")
  If (entry.loadfieldvaluefromfile ("Login Script",
  "sys:nsn\user\test.txt")) Then
     Print "Loaded sucessfully"
  Endif
  If (entry.savefieldvaluetofile ("Login Script",
  "sys:nsn\user\oldscript.txt")) Then
     Print "Saved Sucessfully"
  Endif

4.4.16 SaveFieldValueToFile method

Reads the value of the attributes having NDS syntax stream and saves it to a file.

Syntax

object.SaveFieldValueToFile(
  FieldName As String,
  FileName As String)

Parameters

FieldName

Name of the field value to read.

FileName

Name of file to write field value to.

Return Values

Boolean.

Remarks

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

Example

This example shows how to save the attribute value to a file.

Set nwdir=createobject("UCX:NWDIR")
nwdir.Login ("admin", "password")
Set entry=nwdir.Findentry ("NDS:\\Acmecorp\Sales\TestUser")
  If (entry.Loadfieldvaluefromfile ("Login Script",
  "sys:nsn\user\test.txt")) Then
     Print "Loaded sucessfully"
  Endif
  If (entry.savefieldvaluetofile ("Login Script",
  "sys:nsn\user\oldscript.txt")) Then
     Print "Saved Sucessfully"
  Endif

4.4.17 Update method

Commits the changes to the entry object.

Syntax

object.Update()

Parameters

None.

Return Values

Boolean.

Remarks

This method is called after performing the changes to the attributes.

Example

This example shows how to update changes made to an attribute value.

on Error Resume Next
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("Admin", "password")
Set Entry=nwdir.FindEntry ("NDS:\\Acmecorp\Sales\Newyork")
’Modify the Surname
If (Entry.SetFieldValue ("Surname", "Apps")) Then
   ’Commit the change 
    Entry.Update()
    Print"Updated changes sucessfully"
Else
   Print "Unable to update"
Endif