Hi all,
I am writing a service to fetch Public holidays as in USA Calendar or
any Other Country specific Calendar Provided by google (i m talking
abou the Events mentioned in Interesting Calendars). Can any one help
me out how i can get that.
I have writinn some code please see the SNIP below AND MY COMMENTS IN
CAPS .
<SNIP>
CalendarService objCalendarService = new CalendarService
("localhost-Calendar-v1");
objCalendarService.setUserCredentials
("[email protected]", "MyPasswordHere");
CalendarQuery query = new CalendarQuery();
query.Uri = new Uri("http://www.google.com/calendar/feeds/
default/allcalendars/full");
CalendarFeed resultFeed = objCalendarService.Query(query);
Response.Write("Your calendars:\n");
foreach (CalendarEntry entry in resultFeed.Entries)
{
Response.Write(entry.Title.Text + "<br>");
}
///I GET ALL CALENDARS HERE WHICH I HAVE ADDED
EventQuery objEventQuery = new EventQuery();
//objEventQuery.Uri = new Uri("http://www.google.com/
calendar/feeds/default/private/full");
objEventQuery.Uri = new Uri
("http://www.google.com/calendar/feeds/
[email protected]/public/basic?
singleevents=true");
objEventQuery.StartDate = DateTime.Now.AddYears(-1);
objEventQuery.EndDate = DateTime.Now.AddYears(1);
EventFeed objEventFeed = objCalendarService.Query
(objEventQuery) as EventFeed;
//THE ABOVE LINE RETURNS EMPTY FEED WHERE AS IF YOU SEE
THERE ARE SEVERAL
//EVENTS IN USA PER YEAR AND HAVE HOLIDAYS ON THOS
DAYS
foreach (Google.GData.Calendar.EventEntry entry in
objEventFeed.Entries) //
{
Response.Write(entry.Title.Text + " Date " +
entry.Times[0].StartTime.Date.ToString("dd/MM/yyyy")
+ "<br>");
}
//LOOP NEVER GETS THE CAHNCE TO EXECUTE AS THERE IN NOTHING
IN THE COLLECTION
//objEventFeed.Entries
<END SNIP>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---