ldap.retrieve-values

function

Library: LDAP support (OMLDAP)
Import : omldap.xmd

Declaration
define external function ldap.retrieve-values
    of       value      ldap.attribute entry
    into     modifiable stream         values
    using    value      integer        datatype optional

Argument definitions

entry
An ldap.attribute containing the current entry.
values
A shelf of values returned for the requested attribute.
using
The type of the requested attribute values. The default is ldap.text-type; the other option is ldap.binary-type.


Purpose

This function retrieves the values of the specified attribute of the current entry.

This function is very useful when an attribute may have more than one value.

The following example outputs all of the telephone numbers for each entry satisfying the search. Some entries may have more than one telephone number.

  import "omldap.xmd" prefixed by ldap.
  
  process
     local ldap.connection my-ldap
     local ldap.attribute  my-entry variable
     local stream          phone    variable
  
     set my-ldap to ldap.open 'www.stilo.com'
     ldap.search my-ldap
        base  "o=stilo.com"
        where  "(Department=RD)"
        into   my-entry
        select "phonenumber"
  
     repeat
        exit unless ldap.entry-exists my-entry
        output ldap.entry-name of my-entry || ": "
  
        ldap.retrieve-values of my-entry{"phonenumber"} into phone
        repeat over phone
           output ", " unless #first
           output phone
        again
        output "%n"
        ldap.advance-entry my-entry
     again

ldap.reader can be used when there is only one value, or when you know exactly which values you want.