I have an ASP.NET web application that reads a calendar feed and
displays all event entries for the current date in a side bar area. I
want to display the entries sorted by start time but can't figure out
how to do this. Everything works up to the point where I am looping
through the collection of EventFeed.Entries.

My calendarURI string includes the sorting parameters:

orderby=starttime
sortorder=ascending

The resulting raw feed appears to sort the events in the proper order.
(To test this, I take the calendarURI string and paste it into
Firefox. Events appear in date/time order as expected.)

When I read the feed entries in a program loop, the events appear in
the order they were last updated. Any ideas about how I might correct
this problem? Essentially, I want to display the EventFeed Entries
ordered by the StartTime.

Code snippet shown below. I replaced the actual calendar feed text
with [CalendarFeed].

Thanks,
Jerry Spaeder


System.DateTime CurrentDate = System.DateTime.Now;
string strStartMin = CurrentDate.ToString("yyyy-MM-dd") +
"T00:00:00-08:00";
string strStartMax = CurrentDate.ToString("yyyy-MM-dd") +
"T23:59:59-08:00";
EventQuery query = new EventQuery();
CalendarService service = new CalendarService("MyCalendarService");
string calendarURI = calendarURI = "http://www.google.com/calendar/
feeds/[CalendarFeed]/public/full?ctz=America/
Los_Angeles&orderby=starttime&sortorder=ascending&futureevents=false&singleevents=true&max-
results=10&start-min=" + strStartMin + "&start-max=" + strStartMax;
query.Uri = new Uri(calendarURI);
EventFeed calFeed = service.Query(query) as EventFeed;

foreach (Google.GData.Calendar.EventEntry feedEntry in
calFeed.Entries)
{
        ASPLiteralControl.Text += feedEntry.Title.Text;
        foreach (When when in feedEntry.Times)
        {
                ASPLiteralControl.Text += " " + 
when.StartTime.ToString("MM/dd/yyyy
h:mm tt");
        }
        ASPLiteralControl.Text += "<br />";

}

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to