Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sync with Google Calendar both ways

Do you guys know if Google calendar has any kind of "push" services? Is there a way possible to get all changes for a user's calendar since a particular timestamp?

like image 453
badallen Avatar asked Dec 02 '10 08:12

badallen


People also ask

Can I sync 2 different Google calendars?

To help manage your availability, you can sync with multiple Google Calendar accounts. After enabling the two-way synchronization with a single Google Calendar account, you can sync additional Google Calendar accounts to import various calendars and to export your Schedulista calendar to different Google Calendars.

What is 2 way calendar sync?

Google 2-way sync exports Setmore appointments, classes and recurring appointments to Google. It does not sync Events to Google. The sync imports Google events, recurring events, 24-hour and multi-day events into Setmore.


3 Answers

if u use the Updated-min = lastsynctime you will get the correct new, updated, dleeted events aslo..

 string formatedDate = "";
        EventQuery query = new EventQuery();
        DateTime? time;
        if (!string.IsNullOrEmpty(startDate))
        {
            time = Convert.ToDateTime(startDate);
            formatedDate = string.Format("{0:s}", time);

            // Create the query object:
            query.Uri = new Uri("http://www.google.com/calendar/feeds/" + service.Credentials.Username + "/private/full?updated-min=" + formatedDate);
        }
        else
        {
            query.Uri = new Uri("http://www.google.com/calendar/feeds/" + service.Credentials.Username + "/private/full");
        }


        // Tell the service to query:
        EventFeed calFeed = service.Query(query);
        return calFeed.Entries.Cast<EventEntry>();
like image 130
Shashi Avatar answered Oct 22 '22 17:10

Shashi


This page: http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html Contains all the information you need, including examples.

It will show you how to fetch and push items, and how to query items as you have suggested.

Hope it helps.

like image 38
TimothyP Avatar answered Oct 22 '22 16:10

TimothyP


question was asked as of 2010, but as on 2013 i google has released push notification service which allows notify on your service URL whenever there is any manual change in Events

Check documentatoin from google

https://developers.google.com/google-apps/calendar/v3/push?hl=en

like image 36
chintan123 Avatar answered Oct 22 '22 16:10

chintan123