# # Create a contact for each record. # foreach my $vcf (@vrecs) { my %track; unless ($vcf =~ /^X-GWTYPE:GROUP(END)?/) # Skip group records. { chomp $vcf; # $/ is still "\n\n". $vcf =~ s/=0A=\n/=0A= /g; my @lines = split(/\n/, $vcf); foreach my $line (@lines) { my @parts = split(/:/, $line); $parts[1] =~ s/=0A= /\n/g; $track{$parts[0]} = $parts[1]; } } outlook_vcard(%track); } #### sub outlook_vcard { my(%vcard_props) = @_; my $mail = new Win32::OLE('Outlook.Application'); my $item = $mail->CreateItem(2); # 2 = contact item. unless ($item) { warn "Outlook is not running, cannot save vCard.\n"; return 0; } $item->{FullName} = $vcard_props{'FN'} || $vcard_props{'N'} || ' '; $item->{Company} = $vcard_props{'ORG'} || ' '; $item->{Email1Address} = $vcard_props{'EMAIL;WORK;PREF'} || $vcard_props{'EMAIL;WORK;PREF;NGW'} || ' '; $item->{HomeAddress} = $vcard_props{'ADR;DOM;HOME;PARCEL;POSTAL'} || $vcard_props{'LABEL;DOM;HOME;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE'} || ' '; $item->{BusinessAddress} = $vcard_props{'ADR;DOM;WORK;PARCEL;POSTAL'} || $vcard_props{'LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE'} || ' '; $item->{OtherAddress} = $vcard_props{'ADR;INTL;WORK;PARCEL;POSTAL'} || $vcard_props{'LABEL;INTL;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE'} || ' '; $item->{BusinessTelephoneNumber} = $vcard_props{'TEL;WORK'} || ' '; $item->{MobileTelephoneNumber} = $vcard_props{'TEL;CELL'} || ' '; $item->{HomeTelephoneNumber} = $vcard_props{'TEL;HOME'} || ' '; $item->{PrimaryTelephoneNumber} = $vcard_props{'TEL;PREF'} || ' '; $item->{BusinessFaxNumber} = $vcard_props{'TEL;PREF;FAX'} || ' '; $item->{Title} = $vcard_props{'TITLE'} || ' '; $item->{Body} = $vcard_props{'NOTE'} || $vcard_props{'NOTE;QUOTED-PRINTABLE'} || ' '; $item->Save(); return 1; }