using System;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Calendar;
namespace GoogleCalenderEvents
{
class Program
{
static void Main(string[] args)
{
GetCalenderEvents();
}
static void GetCalenderEvents()
{
// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("GoogleCalenderEventsCom-GoogleCalenderEventsApp-1");
myService.setUserCredentials("email-id", "password");
// Create the query object:
EventQuery eventquery = new EventQuery();
eventquery.Uri = new Uri("http://www.google.com/calendar/feeds/mail-id@gmail.com/private/full");
// Tell the service to query:
EventFeed calFeed = myService.Query(eventquery);
foreach (EventEntry entry in calFeed.Entries)
{
Console.WriteLine("Title : " + entry.Title.Text);
Console.WriteLine("Locations : " + entry.Locations[0].ValueString);
Console.WriteLine("Start Date: " + entry.Times[0].StartTime.ToShortDateString());
Console.WriteLine("Start Time: " + entry.Times[0].StartTime.ToShortTimeString());
Console.WriteLine("End Date: " + entry.Times[0].EndTime.ToShortDateString());
Console.WriteLine("End Time: " + entry.Times[0].EndTime.ToShortTimeString());
for (int i = 0; i < entry.Participants.Count; i++)
{
Console.WriteLine("Participant : " + i + " : " + entry.Participants[i].ValueString);
}
Console.WriteLine("\n\n");
}
}
}
}
Wednesday, June 24, 2009
Google Calender Events Sample
Google Contacts was my first experiment with Google Data API. So I thought why not try out Google Calender Events. I started working on my app to fetch Calender Events from Google Servers and finally got it to work after spending lot of time experimenting wih the code. Next is Google Picasa Photos. I will post the code snippet in my next post.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment