Superb! thanks, this is now working. On 3.4 though i had adjusted the script to import contacts into a different OU called Contacts.
I've moded the new one to the following but am having problems:-
#!/usr/bin/perl
use strict;
use warnings;
use EBox;
use EBox::Samba::Contact;
use File::Slurp;
EBox::init();
sub FindContainer {
my ($class, $ro) = @_;
my $usersMod = EBox::Global->getInstance($ro)->modInstance('samba');
return $usersMod->objectFromDN('CN=Contacts,' . $usersMod->ldap->dn());
}
my @lines = read_file('contacts.csv');
chomp (@lines);
my $parent = FindContainer();
for my $line (@lines) {
my ($username, $givenname, $surname, $email) = split(',', $line);
EBox::Samba::Contact->create(
samAccountName => $username,
parent => $parent,
givenName => $givenname,
sn => $surname,
mail => $email
);
}
1;
It keeps saying "missing argument: parent"
the findcontainer sub is pinched from the contacts.pm file with a moded DN path.
Can't see why it's returning a blank value though! (I have created the OU Contacts)
Dave