Introduction

We are going to synchronize google-calendars(Personal, Work) with evolution calendars (Personal, Work) respectively.For shake of simplicity we took similar name for these calendars.

These following commands are documented assuming one is using the latest version of syncevolution (syncevolution >=1.4.x)

Sync Scenario

Google Calendar

Evolution Calendar

Source

Database

Peer

Work

Work

workcal

Work

gcal

Personal

Personal

personalcal

Personal

(i) One can choose any arbitrary peer name.


Setup

Synchronization between work calendars is shown here.

First add a google account with Ubuntu-Online-Account (UOA) OR Gnome-Online-Account (GOA). The username would be like uoa:ACCOUNT_ID,SERVICE_NAME OR goa:YOURUSERNAME@gmail.com for UOA & GOA respectively. If there are multiple accounts with same username (for example: Google & Jabber), acccount-id is used.

Username for, UOA == uoa:ACCOUNT_ID,SERVICE_NAME {OR} UOA == uoa:10,google-calendar

Username for, GOA == goa:YOURUSERNAME@gmail.com {OR} GOA == goa:1687347_526_7

Since UOA & gsso are both based on libgsignond, they will share the same username format. For UOA, to get ACCOUNT_ID users first need to install libaccounts-glib-tools. ACCOUNT_ID can found by running command:

ag-tool list-accounts

It wiil list email-address, provider name & corresponding ACCOUNT_ID...which can be use to find SERVICE_NAME with following command:

ag-tool list-services <ACCOUNT_ID>

For eaxample: ag-tool list-services 9. It will show service type & corresponding SERVICE_NAME. Then one can form username in the required format (i.e uoa:ACCOUNT_ID,SERVICE_NAME). The default SERVICE_NAME for google calendar is google-calendar.

For caldav or carddav sync these services must be enabled. It can be done from Ubuntu-Online-account GUI (settings->online Accounts) {OR} running command in the following format:

ag-tool enable-service <ACCOUNT_ID> <SERVICE_NAME>

(i) Complete information regarding integration with Goa,Uoa/gsso can be found here: http://cgit.freedesktop.org/SyncEvolution/syncevolution/plain/src/backends/signon/README & http://cgit.freedesktop.org/SyncEvolution/syncevolution/plain/src/backends/goa/README

This username is required in Step1 (For New Methods).

(OK) Syncevolution in Ubuntu <=13.10 (from official repo) is NOT compiled with Ubuntu-Online-Account. For UOA, One must compiled syncevolution from source with uoa enabled.For Ubuntu >=14.04 users must install syncevolution-provider-uoa to make it work with Ubuntu-Online-Accounts.

1. Create a Peer for Google calendar (gcal)

New Method (Required Syncevolution >=1.4 & Ubuntu >=13.10)

syncevolution --configure --template SyncEvolution username=uoa:ACCOUNT_ID,google-calendar syncURL=https://apidata.googleusercontent.com/caldav/v2 target-config@gcal

Replace ACCOUNT_ID with your own <ACCOUNT_ID> number. If there are multiple accounts of same username it will fail but print account-id in terminal. Next time use that account-id to select a specific google-account.

OR

Old Method (For Syncevolution >=1.32 & Ubuntu >=10.04)

syncevolution --configure --template Google_Calendar username=YOURUSERNAME@gmail.com password=**** target-config@gcal

(X) Caution: Old method uses plain authentication which was meant to be disabled by Google & may not work properly.

(i) Here Google_Calendar template is used. One can also use webdav template (for old method). To list the known configuration templates run following commands at terminal-prompt:

syncevolution --template ?

2. Create a new source for work calendar

syncevolution --configure backend=evolution-calendar database=Work @default workcal

3. Add a remote database to the source (workcal)

When Using New Method (in Step-1):

syncevolution --configure database=https://apidata.googleusercontent.com/caldav/v2/GOOGLECALENDARID@group.calendar.google.com/events backend=caldav target-config@gcal workcal

Replace GOOGLECALENDARID with your own google-calendar id for work calendar. To find the required calendar-id go to google-calendar. Hover mouse over respective calendar, click down arrow & select settings.Then copy the calendar id as shown in the following image:

http://i.imgur.com/urehOZB.png

http://i.imgur.com/RSjnAZ4.png

OR

When Using Old Method (in Step-1):

syncevolution --configure database=https://www.google.com:443/calendar/dav/GOOGLRCALENDARID@group.calendar.google.com/events/ backend=caldav target-config@gcal workcal

4. Connect remote calendars with local databases (sync-config)

syncevolution --configure --template SyncEvolution_Client syncURL=local://@gcal username= password= gcal workcal

5. Add a local database to the source (workcal)

syncevolution --configure sync=two-way database=Work gcal workcal 

To list all local databases run following command at terminal-prompt:

syncevolution --print-databases

6. Check whether configured properly (Optional)

To check whether all configuration is working properly one can print all items in local or remote databse.

To print all items(calendar events) in local database run:

syncevolution --print-items gcal workcal 

To print all items(calendar events) in remote database run:

syncevolution --print-items target-config@gcal workcal

7. Start syncing (First-Time)

syncevolution --sync refresh-from-remote gcal workcal 

(i) For the first-time sync it is strongly recommended to use -- sync refresh-from-remote or --sync slow option during the sync to avoid duplicity.

(X) Caution: "refresh-from-client" option WILL DELETE EVERYTHING IN EVOLUTION CALENDAR (for caldav/carddav client is remote server & server is local client i.e. syncevolution) AND REPLACE WITH GOOGLE-CALENDAR.

To find all possible sync-option run following command at terminal-prompt:

syncevolution --sync ?

General sync-options are explained below:

Sync Option

Meaning

two-way

Normal two-way sync

slow

Exchange all data. Recommended for first time sync to avoid duplicity

refresh-from-remote

Deletes everything on client & replaces with server

refresh-from-local

Deletes everything on server & replaces with client

refresh-from-client

Deletes everything on server & replaces with client (opposite for caldav/carddav)

refresh-from-server

Deletes everything on client & replaces with server (opposite for caldav/carddav)

8. Start Normal Sync (After first sync)

syncevolution gcal workcal

This will start two-way sync which is the default sync-option defined in step 5.

For other calendars repeat steps 2,3,4,5,6 & 7 with separate data-source & calendar-id for each calendar.Multiple data-sources can be synced at the same time:

syncevolution gcal workcal personalcal

To sync all sources under a peer run:

syncevolution gcal

http://i.imgur.com/dLJJUew.png


Restore from backup

One can go back to original state if anything goes wrong during the sync. SyncEvolution automatically creates backup for each sync-session & saves as logdir(log directory) to '~/.cache/syncevolution.

To list all sessions for the peer gcal run following command at terminal-prompt:

syncevolution --print-sessions --quiet gcal

The output would be something like this:

/home/$USERNAME/.cache/syncevolution/gcal-2013-01-31-19-56
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-16-20-57
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-16-21-50
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-16-21-52
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-22-12-59
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-26-14-05
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-28-14-30
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-29-23-08
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-29-23-47
/home/$USERNAME/.cache/syncevolution/gcal-2013-05-30-19-45

What we need here is the session directory path which is /home/$USERNAME/.cache/syncevolution/gcal-2013-05-30-19-45 (last sync session) from the above example. On can restore either after or before the sync for each sync-session except the last.

The default restore command with all parameters looks like this:

syncevolution --restore <session directory> --before|--after [--dry-run] [--] <config> <source> 

(i) Remove --dry-run option option to write data to evolution-data-server. However it is recommended to pass --dry-run option (before running without it) to view all calendar events that are going to be restored.

For example, to restore workcal before last sync-session run:

syncevolution --restore /home/$USERNAME/.cache/syncevolution/gcal-2013-05-30-19-45 --before gcal workcal

To restore all sources under gcal run:

syncevolution --restore /home/$USERNAME/.cache/syncevolution/gcal-2013-05-30-19-45 --before gcal


Other Command-Line Usage

List all databases:

syncevolution --print-databases

List all sessions under a peer:

syncevolution --print-sessions --quiet gcal

Show information about configuration(s):

syncevolution --print-servers|--print-configs|--print-peers

(i) either use --print-servers OR --print-configs OR --print-peers

Show information about a specific configuration:

syncevolution --print-config --quiet gcal workcal

List local calendar items:

syncevolution --print-items gcal workcal

List remote calendar items:

syncevolution --print-items target-config@gcal workcal

Prints what changes were made locally since the last synchronization:

syncevolution --status gcal workcal

Remove a config/peer:

syncevolution --remove gcal

Create, update or remove a configuration:

syncevolution --configure <options> [--] <config> [<source> ...]

To view all command-line options go to syncevolution-usage wiki page.

SyncEvolution/synchronize-multiple-google-calendars-with-evolution-calendars (last edited 2014-11-13 11:06:05 by 117)