Connecting OS X Address Book.app to LDAP
Up until now, this posting to the openldap-software mailing list by Apple employee Gary La Voy is by far the most complete description I’ve ever seen of the LDAP fields supported by Mail.app. I suppose this is all there is to know about LDAP and Address Book – unless of course more has been added in Leopard.
Just now, I stumbled across this Ethereal dump of Address Book’s query to an LDAP server which is extremely valuable. This O’Reilly page also has a useful summary if you’re just getting started, but it’s really the Ethereal dump that’s going to save you. (You can install Ethereal via MacPorts)
Here’s the complete dump of the LDAP Connection from Address Book:
Lightweight Directory Access Protocol
LDAP Message, Search Request
Message Id: 2
Message Type: Search Request (0x03)
Message Length: 291
Response In: 8
Base DN: (null)
Scope: Subtree (0x02)
Dereference: Never (0x00)
Size Limit: 0
Time Limit: 30
Attributes Only: False
Filter: (|(givenname=carmo)(sn=carmo)(cn=carmo)(mail=carmo))
Attribute: givenName
Attribute: sn
Attribute: cn
Attribute: mail
Attribute: telephoneNumber
Attribute: facsimileTelephoneNumber
Attribute: o
Attribute: title
Attribute: ou
Attribute: buildingName
Attribute: street
Attribute: l
Attribute: st
Attribute: postalCode
Attribute: c
Attribute: jpegPhoto
Attribute: mobile
Attribute: co
Attribute: pager
Attribute: destinationIndicator
Attribute: labeledURI
Attribute: IMHandle
I just did some OpenLDAP debugging and got this list of attributes for Leopard 10.5.1:
givenName sn cn mail telephoneNumber facsimileTelephoneNumber o title ou buildingName street l st postalCode c jpegPhoto mobile co pager destinationIndicator labeledURI IMHandle
Once you get all of these popped into an LDAP directory entry, the result is something like this:

Note that IMHandle, buildingName, commonName, pager, ou and co fields do not get displayed on the contact card. Additionally, only one email address will be displayed (the first one) regardless of how many email addresses exist on the contact record. I’ve spent several hours trying to get IMHandle to work (apple-imhandle), but it never seems to populate. Apparently, I’m not the only one with this issue. Save yourself the trouble – don’t bother.
Apparently Mac OS X Server is required if you want to serve up Instant Messenger contact info.

I was trying to get IM information to display in the Address Book using IMHandle but didn’t have much luck. I figured out a work around using the labeledURI field, as I mentioned on my blog: http://infinitesteps.blogspot.com/2009/05/apple-address-book-and-im-values.html
@Dannie M Stanley Dannie, I think that using the labeledURI field is a pretty interesting idea for storing IMHandle data, but there are two problems with it for me. Obviously it prevents storage of the regular URL data. The other big drawback is that there is only one labeledURI field, so if someone has multiple instant message fields that you want to track I think you’re out of luck.
But for many people it’s still a very good tradeoff. I’ll look into your idea more!
Have no enough money to buy a car? Worry not, just because it’s available to receive the home loans to solve all the problems. Thus take a short term loan to buy all you need.