Item Operations#
SyncEvolution can use its backends to export, add, update and delete items in local storages (EDS, Akonadi) and some remote storages (CalDAV/CardDAV). It is possible, but not necessary, to create a configuration to use these features. This page gives examples, the command line documentation has the full specification of these options.
Without configuration#
First, let’s list available local databases. In this HOWTO, only EDS is used.
$ syncevolution --print-databases
Evolution Address Book = Evolution Contacts = evolution-contacts:
Personal (local:system) <default>
SyncEvolution_Test_eds_contact_1 (local:1233579606.3854.0@pohly-MOBL)
Evolution Calendar = evolution-calendar:
Personal (local:system) <default>
...
Now we can list the items, with one line for each item:
$ syncevolution --print-items \
backend=evolution-contacts
database=local:1233579606.3854.0@pohly-MOBL
pas-id-5006660000000D81: char set
pas-id-5017A30900000670: John Doe
The database
property is optional. If not given, the default database is
used. The first word before the colon is an item ID. It is guaranteed to not
contain a colon or characters that are special in a shell. The other item
operation commands take such item IDs as optional parameters.
Print to stdout (mind the hyphen after --export
!), using the native data
format of the storage (no conversion):
$ syncevolution --export - \
backend=evolution-contacts \
database=local:1233579606.3854.0@pohly-MOBL \
--luids pas-id-5017A30900000670
BEGIN:VCARD
VERSION:3.0
UID:pas-id-5006660000000D80
REV:2012-07-18T07:32:24Z
N:Doe;John;;;
FN:John Doe
X-EVOLUTION-FILE-AS:Doe\, John
NICKNAME:user1
TITLE:Senior Tester
ORG:Test Inc.;Testing;test#1;
ROLE:professional test case
TEL;TYPE=PAGER:pager 6
TEL;TYPE=CELL:mobile 3
TEL;TYPE=HOME,VOICE:home 10
TEL;TYPE=HOME,FAX:homefax 5
TEL;TYPE=HOME,VOICE:home 2
TEL;TYPE=CAR:car 7
TEL;TYPE=WORK,VOICE:business 9
TEL;TYPE=WORK,FAX:businessfax 4
TEL;TYPE=WORK,VOICE:business 1
EMAIL;TYPE=INTERNET:john.doe@home.priv
EMAIL;TYPE=INTERNET:john.doe@other.world
URL:http://john.doe.com
X-EVOLUTION-MANAGER:John Doe Senior
X-EVOLUTION-ASSISTANT:John Doe Junior
ADR;TYPE=HOME:;;Test Drive 1;Test Village;Lower Test County;12345;Testovia
ADR;TYPE=WORK:;;Test Drive 3;Test Megacity;Test County;12347;New Testonia
BDAY:20060108
NOTE:This is a test case which uses almost all Evolution fields.
END:VCARD
When several IDs are given, the vCards are seperated by empty lines, which are guaranteed to not occur in the items themselves. When no ID is given, all items are exported.
Now let’s update the contact:
$ syncevolution --export /tmp/john.vcf \
backend=evolution-contacts \
database=local:1233579606.3854.0@pohly-MOBL \
--luids pas-id-5017A30900000670
$ perl -p -e 's/John/Joan/' /tmp/john.vcf >/tmp/joan.vcf
$ syncevolution --update /tmp/joan.vcf \
backend=evolution-contacts \
database=local:1233579606.3854.0@pohly-MOBL \
--luids pas-id-5017A30900000670
#0: pas-id-5017A30900000670
And delete it:
$ syncevolution --delete-items \
backend=evolution-contacts \
database=local:1233579606.3854.0@pohly-MOBL \
--luids pas-id-5017A30900000670
[INFO] deleting "Joan Doe"
It is also possible to wipe out all items at once:
$ syncevolution --delete-items \
backend=evolution-contacts \
database=local:1233579606.3854.0@pohly-MOBL \
--luids '*'
....
With configuration#
It is possible to store the necessary settings in a source config:
$ syncevolution --configure \
backend=evolution-contacts \
database=local:1233579606.3854.0@pohly-MOBL \
@default test-addressbook
$ syncevolution --import /tmp/joan.vcf @default test-addressbook
#0: pas-id-5017A47000000671
Note that EDS does not preserve an existing UID when importing a vCard, therefore we end up with a new ID here. The same syntax also works for sync configs, if such a config was set up already:
$ syncevolution --print-items memotoo addressbook ...
CalDAV/CardDAV#
To access a WebDAV server, username and password are usually required. If the server does not support auto discovery, then the URL also needs to be provided:
$ syncevolution --print-databases \
backend=CalDAV \
username=user01 \
password=user01 \
syncURL=http://localhost:8008
CalDAV: calendar (http://localhost:8008/calendars/__uids__/user01/calendar/) <default>
$ syncevolution --print-items \
backend=CalDAV \
username=user01 \
password=user01 \
database=http://localhost:8008/calendars/__uids__/user01/calendar/
1234567890%40dummyVEVENT%2eics: phone meeting - modified 2, my office
1234567890xxxx%40dummyVEVENT%2eics: some other meeting xxx yyy
1234567890yyy%40dummyVEVENT%2eics: some other meeting xxx
1234567890yyyxxxzzzz%40dummyVEVENT%2eics: some other meeting xxx yyy zzzz