Skip to content

matchaxnb/parse-vcard-to-exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

parse-vcard

This tool parses a collection of vcards, such as those extracted from Roundcube, and generates a CSV that is fit to be imported on Outlook.

Tips

Export vcards from roundcube

USE roundcube
tee contacts.lst
SELECT c.vcard contact_vcard
FROM 
    contacts c INNER JOIN
    contactgroupmembers cgm ON cgm.contact_id = c.contact_id INNER JOIN
    contactgroups cg ON cgm.contactgroup_id = cg.contactgroup_id
WHERE
    c.del <> 1
GROUP BY c.contact_id\G
grep -v 'row ***' contacts.lst > /tmp/f
mv /tmp/f contacts.lst

Convert CSV

cat contacts.lst | python parse_vcards.py contacts.csv

Import to Office 365

Follow this guide to log-in in a PowerShell session.

Then follow this guide to import the CSV.

If you need to purge all contacts, after logging-in, do this in PowerShell:

Get-MailContact | Remove-MailContact

Fill placeholder e-mails when this info is missing (pity)

N=1
cat contacts.lst | while read l; do N=$(($N + 1)); echo $l | sed 's!^,!'$N'@missing.email.invalid,!g' ; done  > /tmp/f;
mv /tmp/f contacts.lst

With this you should be all set.

This is quite minimal, but it does the job for bulk import.