Using the LDAP service of a Lotus Notes / Domino server, I cannot
get the telephone attribute for people. Sad it is but Lotus like M$
call it telephonenumber. I use ‘net/ldap’ for this which works fine
for
other attributes. Net::LDAP#search delivers an Array of
Net::LDAP::Entry objects, and I can call attributes like the
following simplified example shows:
ldap.search( :base => base, :filter => ldap_filter ) do |entry|
puts “DN: #{entry.dn} Name: #{entry.givenname} #{entry.sn}”
end
Now, it looks like the telephonenumber attribute is not delivered.
Having done a simillar application in Perl (using Net::LDAP) which
still works with the same LDAP server and parameters, I know the
attribute should be there. But the following results in a
NoMethodError exception.
ldap.search( :base => base, :filter => ldap_filter ) do |entry|
puts “Phone: #{entry.telephonenumber}”
end
Using entry.telephone doesn’t help, and adding the attribute
list to the Net::LDAP#search (e.g. [:dn, :sn, :telephonenumber])
doesn’t help.
Btw: In the above code block I tried entry.methods.sort
and was really surprised it did not show things like ‘dn’ or
‘mail’ as its methods; however they are working.
Any idea how to get this telephonenumber attribute?
Hi. Strange: Looks like somebody posted a reply
which I could not see - neither in the news reader
nor in groups.google.com.
The sender’s ID was ‘garbagecat10’.
I found the reply when giving it another trial
under “Forbiddenweb Archive”. Anybody any idea
what happened there?
Ok, here is the contributor’s question back to me,
so he/her or anybody else may have further ideas:
What happens if you use Net::LDAP::Entry#each to dump
out all of the attributes that were returned from the
server?
checkpassword
objectclass
roamcleanper
mail
maildomain
personaltitle
availablefordirsync
dn
So no telephonenumber, no telephone.
Ok, that’s really weird. Did you try setting the attributes parameter to
Net::LDAP#search? If that doesn’t work, then please try something like
ldapsearch and verify that the attribute really is returned. (I know you
said Net::LDAP in perl worked, but I’d like a little more confirmation.)
If that fails, then it could be a bug in Net::LDAP and I’ll want to
follow
up with you offlist to track it down.
If you have access to the LDAP server admin, you might want to ask if
there is a filter preventing anonymous binds from revealing the
telephone
attribute.
Your code seems to imply that your are doing anonymous binds.