[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Converting an Out Look addressbook to ldif
- To: openldap-software@OpenLDAP.org
- Subject: Re: Converting an Out Look addressbook to ldif
- From: "Anthony E . Greene" <agreene@pobox.com>
- Date: Thu, 11 Jan 2001 20:17:39 -0500
- In-reply-to: <3A5E03E8.759C7DC8@javali.com.br>; from reis@javali.com.br on Thu, Jan 11, 2001 at 14:05:12 -0500
- References: <3A5E03E8.759C7DC8@javali.com.br>
On Thu, 11 Jan 2001 14:05:12 Alberto Silos Reis wrote:
>How can I convert an outlook addressbook to ldif format. Can I do this
>only with netscape?
Make sure all the entries are in the Outlook address book.
Import the Outlook Address book into Outlook Express. This will resolve all
the Exchange addresses and convert them into SMTP addresses.
Export the Outlook Express address book into a comma-delimited text file.
Use your favorite text processing tool to convert the comma-delimited file
to LDIF. I use the quotewords() function in Perl's Text::ParseWords module.
See attached example script.
Tony
--
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D
Chat: AOL/Yahoo: TonyG05 ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>
#!/usr/bin/perl -T -w
#
# This is an example of using the Text::ParseWords module to convert
# a comma-delimited file to LDIF. Requires Perl 5.005 or higher.
#
# Anthony Greene <agreene@pobox.com>
#
# Load the required module.
use Text::ParseWords;
# Normally I would read from STDIN using a line like this:
# while ($line = <STDIN>) {
# but I set the values for this example.
$line = '"Anthony Greene","Anthony","Greene","agreene@pobox.com"';
# Parse the line.
@fields = "ewords(',',0,$line);
# Set variable values based on the array values.
my $cn = $fields[0];
my $givenname = $fields[1];
my $sn = $fields[2];
my $mail = $fields[3];
# Output the values.
print "dn: cn=$cn,dc=my_org,dc=my_domain\n";
print "cn: $cn\n";
print "givenname: $givenname\n";
print "sn: $sn\n";
print "mail: $mail\n";
print "\n";
# Here I would normally end my while loop.
# }
# end of script.
exit;