Sunday, April 13, 2008

Sourceforge project ldaptoaddressbo

To share the code of this project I've requested a Sourceforge project named LDAP to Address Book.

I received approval and am now in the process of putting the source code under its CVS. For the time being you can download the Xcode project code and the compiled application via the related website.

Next

There are three things I want to add in the coming weeks:
  1. An interval so it will start doing auto syncs with your LDAP Server
  2. Make it a system preference
  3. Clean up the code

Saturday, April 12, 2008

Introduction

Leopard Mac OS X Server did not introduce a simple solution for sharing your Address Book with others. Yes there is the Directory Utility in which you can define shared co
ntacts, which you can then move to your Address Book. Or you can open 
your Address Book client and search the Directory Services or even approach the Mac OS X Server build-in LDAP Server.

The first solution, move from the Directory Utility will make a copy
 of the contacts but there are no updates. The second, access Directory Services from Address Book will work, gives you all the data however you cannot create groups on the contacts. Well you can copy the into your address book but then, again, no updates. Connect to the LDAP server will give you the update function but only seven attributes will be copied.

Yes there are third party solutions for our problem, however they build a solution besides the Apple "solution". We worked from the LDAP Server running under the Leopard Mac OS X Server. Looked up which attributes were used by the Directory Utility. Next step get used to Objective-C since the Objective-C API for Address Book seems to be the best, an example called addresses helped us. Then we found a way to get the LDAP framework into Objective-C. So we had the two parts, a way to get data from LDAP and to put data into the Address Book. From there I wrote a seperate Objective-C class that matches the LDAP attributes to the Address Book attributes. There are three tables inside the addressBook.m class which do all the mapping. That is the first version which you can download from here.

On top of this I builded a Cocoa GUI:


With this you can fill in your own LDAP Server and Port, fill in the Bind DN. The interval value is ignored.. When changing any of the attributes you can always go to the previous settings by clicking "Cancel". If the values are fine with you can can click apply and these values will be saved as defaults.

By pressing the "Sync" button the synchronization itself will start. If nothing happens please check your address book if anything changed. If not check your logging via the Console Utility.