开发者

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?


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>();


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.


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


sure

var service = new CalendarService(domainName);
service.setUserCredentials(email, pwd);

// Create the query object:
EventQuery query = new EventQuery();
query.Uri = new Uri(string.Format("https://www.google.com/calendar/feeds/{0}/private/full", email));

// Tell the service to query:
EventFeed calFeed = service.Query(query);
return calFeed.Entries.AsEnumerable().Cast<EventEntry>().Where(entry => ???);

in 'query' object u can add condition u want such as 'query.StartDate'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜