Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: Christopher on February 17, 2005, 04:13:17 PM

Title: Here's a tool to add Outlook contacts to global address book
Post by: Christopher on February 17, 2005, 04:13:17 PM
Hi all,

I needed a way for my users to add their Outlook contacts Ad-hoc into the global address book that I set up using

http://mirror.contribs.org/smeserver/contribs/hmuhammad/

in a very easy way.

What my users do is use the Outlook "Save As" vCard file - into an iBay on the server and I've written a little app that copies the vcf's to the end of the contacts text file, then removes them - so they're not duplicated. It's just a simple thing that runs from cron. If its any use to people I'll do a contrib or howto or whatever's appropriate, thing is I'm new to linux programming and have never done any contribs or anything like that before (long time micro$ofty!), so I'll need some help.

its easy to set up:
put this file:
http://freespace.virgin.net/c.doyle/vcard
in /usr/local/sbin

this file:
http://freespace.virgin.net/c.doyle/vcard.sh
in /etc/cron.hourly

and this file:
http://freespace.virgin.net/c.doyle/vc2ldap.conf
in /etc

Then edit vc2ldap to set the directory path for the vcf's and the txt file (by default its /home/e-smith/files/ibays/Primary/files/SampleLuminaires.txt

If this is of any use, please reply and I'll do the honours.

Regards,

Chris.
Title: Here's a tool to add Outlook contacts to global address book
Post by: hmuhammad on February 17, 2005, 06:17:14 PM
Chris,

Glad the add-on was helpful and that you've found a way to make it even more so for you... ain't opensource great!!

Just to be sure I understand your technique... is it meant to save a single contact record per each 'save-as'?

BTW... I'm pretty sure the add-on could be enhanced to allow each user to dump, via 'save-as', all their contacts into a text file in their home directory--which would be automatically imported into the LDAP directory; then accessed from a LDAP client (Thunderbird, Outlook, Outlook Express, etc.) config'd as 'My Contacts: dc=jdoe,dc=domain,dc=com'. And, also accessed via a 'My Contacts' drop-down list from within webmail.

But I have two (2) concerns about such a setup:
1) Would users actually find the 'save-as' process convenient enough to regularly use it?

2) Is LDAP on SME Server secure enough to allow public access (from offsite email clients)?

Any feedback (from anyone) is appreciated.

Thanks,
Hasan

P.S.

Here's how to change the RPM to accommodate your changes...
http://no.longer.valid/phpwiki/index.php/minor%20revision

...you could take a look at it as a start up your learning curve.    

I think its much easier to enhance the add-on to accommodate your changes than the ones I'm suggesting, so I'll try to upgrade it this weekend to add your changes. Then at least you'll find out how to make such changes.
Title: Re: Here's a tool to add Outlook contacts to global address
Post by: hmuhammad on February 18, 2005, 04:46:06 AM
Quote from: "Christopher"
Hi all,

...
its easy to set up:
put this file:
http://freespace.virgin.net/c.doyle/vcard
in /usr/local/sbin

...

Regards,

Chris.



Chris,

Started to update the smeserver-ldap-contacts add-on to include your files and discovered that the above file is a binary... not quite comfortable with adding a binary executable to a SRPMS (source RPM).

Is it possible for you to write that app in a scripting language (perl/php/python/bash etc.) ?

Thanks,
Hasan
Title: Here's a tool to add Outlook contacts to global address book
Post by: Christopher on February 18, 2005, 09:17:07 AM
Hi Hasan,

The tool is designed to run every so often and it converts all vCards that it finds in the input directory "batch mode".

Its primary goal is to allow a quick way of adding contacts from incoming e-mails, thats why its orientated around a single contact, I think your way is better anyway to add a lot of contacts in one go.

It can also be used to grab contacts straight from a mobile phone via IR or Bluetooth.

I'm afraid I know diddley squat about any of these scripting languages, however I'm keen to learn, so I think I'll do it in PERL.

A few thoughts though:

I'll use the Leo Lapworth - "Text-vCard" module from CPAN, so it  can read all vCards, without knowing perl, will this cause dependancy/licencing issues?

If its possible to pass a command line parameter to a perl script from cron, it would mean that the file locations config file could be specified on the command line, so we can have user and global address books, as you were talking about.

I notice that your panel lists the column numbers of each field, I should use this so my columns are the same as yours, can you tell me where this config is kept please, also do I parse it myself, or is there a parser tool in PERL for it?

Many Thanks,

Chris.
Title: Here's a tool to add Outlook contacts to global address book
Post by: hmuhammad on February 18, 2005, 05:22:11 PM
Quote from: "Christopher"
Hi Hasan,

The tool is designed to run every so often and it converts all vCards that it finds in the input directory "batch mode".

Quote from: "Hasan"

cool


I'll use the Leo Lapworth - "Text-vCard" module from CPAN, so it  can read all vCards, without knowing perl, will this cause dependancy/licencing issues?

Quote from: "Hasan"

...dependancies from CPAN should be self-evident with 'hints' to guide you. (Also, look at some of the update scripts in this forum for examples of using CPAN.)

...licensing? I believe CPAN is "all you can", I don't think licensing would be a problem, but IANAL.


If its possible to pass a command line parameter to a perl script

Quote from: "Hasan"

look at lines 51 and 58 of...
  /etc/e-smith/events/actions/ldap-update
for how to get CL parms from a perl script


from cron, it would mean that the file locations config file could be specified on the command line, so we can have user and global address books, as you were talking about.

Quote from: "Hasan"

see below how you can get the file location from the 'e-smith configuration database'

However, I suggest that the first version not tackle the multiple users problem. But, yes, the location info for those address books could be but in the configuration database (or the textfiles and vcards for the address books could be put in a specified subdirectory of each users home directory).


Quote from: "Hasan"

the e-smith way of setting/getting parameters is via the...
  /home/e-smith/configuration
database

see lines 25-34 and 82-92 of...
  /etc/e-smith/events/actions/ldap-contacts-startup
as an example of how to set config parmaters from a perl script; and

see lines 64-58, and
see line 70
as examples of how to get config parms from perl

see lines 291-293 of...
  /etc/e-smith/events/action/floppy-put-image
as an example of how to set config parameters from a bash script

see lines 15, 18-21 of...
  /etc/e-smith/events/actions/ldap-contacts-import
as an example of how to get ccnfig parms from bash


 
I notice that your panel lists the column numbers of each field, I should use this so my columns are the same as yours, can you tell me where this config is kept please, also do I parse it myself, or is there a parser tool in PERL for it?

Quote from: "Hasan"

Those column numbers match the column layout of the example textfile...
/home/e-smith/files/ibays/Primary/files/SampleLuminaries.txt

If the textfile containing the global contacts to be import was create via an export from Thunderbird, Outlook or Outlook Express, the column numbers would be different (and should be specified via the configuration panel).

Since you vcard technique is already working for you using the sample column numbers... (if it ain't broke, don't fix it).

To find the column numbers in the configuration database, as root, do this...
grep contacts= /home/e-smith/configuration



Many Thanks,

Chris.