Hi,

You should try setting the query attribute using the property of the query
object instead of appending them with the query URI.  And for some reason
there is no "OrderBy" query property in the query object, so you can use the
ExtraParameters query property to set this.  This is an example of how to
retrieve a list of events sorted by start time in ascending order (using C#
.NET) -

    public void getAllEvents() {

        EventQuery query = new EventQuery();
        query.Uri = new Uri("
http://www.google.com/calendar/feeds/default/private/full";);

        query.SortOrder = CalendarSortOrder.ascending;
        query.ExtraParameters = "orderby=starttime";
        query.SingleEvents = true;

        EventFeed feed = calendarService.Query(query);

        for (int i = 0; i < feed.Entries.Count; i++) {
            EventEntry entry = (EventEntry) feed.Entries[i];
            Console.WriteLine(entry.Title.Text);
        }
    }

Hope it helps,
Austin

On Sun, Mar 2, 2008 at 11:18 AM, Jerry Spaeder <[EMAIL PROTECTED]> wrote:

>
> 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=<http://www.google.com/calendar/feeds/%5BCalendarFeed%5D/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