That was it. Thank you! Dear Google -- a doc update might help others
here. -Travis

On Dec 10, 3:52 am, "Ray Baxter" <[EMAIL PROTECTED]> wrote:
> Travis,
>
> Yeah, cut and paste can be awkward, especially in a web browser.
>
> I think that this part of your code is wrong:
>
>    foreach (When time in entry.Times)
>         {
>           DateTime start = time.StartTime;
>           foreach (Reminder reminder in entry.Reminders)
>
> You want something like this:
>
>    foreach (When time in entry.Times)
>         {
>           DateTime start = time.StartTime;
>           foreach (Reminder reminder in time.Reminders)
>
> For a recurrent event, retrieved with a query on start and end time,
> each time has an associated set of reminders (sms 10 minutes before,
> email 30 minutes before, etc) . I'm not sure what the .NET framework
> returns you when you call entry.Reminders in this case, but in this
> case, I don't think it is what you want.
>
> Hope that helps,
>
> Ray
>
>
>
> On Tue, Dec 9, 2008 at 2:08 PM, Travis <[EMAIL PROTECTED]> wrote:
>
> > Sorry, cut and paste error killed my post, then I decided to go look
> > for someone else to confirm the problem.
>
> > With a standard calendar event, the code below works as expected -- it
> > prints the reminder information in a textbox. However, with a
> > recurring event, we get a random number for event.Reminders.Count on
> > every loop traversal as if a pointer is falling off the end of a list
> > somewhere -- infinite loop until memory is exhausted in foreach
> > reminder loop. Using VS 2008 sp1, latest patches, .net 3.5, latest
> > download of .Net google api.
>
> >        private void doit()
> >        {
> >            CalendarService myService = new CalendarService
> > ("testapp");
> >            string feedUrl;
>
> >            foreach (Keyword keyword in Keyword.GetAll())
> >            {
> >                EventFeed myResultsFeed = null;
>
> >                if (keyword.GoogleCalendar != null &&
> > keyword.GoogleCalendar != "")
> >                {
> >                    feedUrl = keyword.GoogleCalendar.Replace("/basic",
> > "/full"); // valid, external
>
> >                    EventQuery myQuery = new EventQuery(feedUrl);
> >                    myQuery.StartTime = new DateTime
> > (DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
> >                    myQuery.EndTime = myQuery.StartTime.AddMonths
> > (1).AddSeconds(-1);
>
> >                    try
> >                    {
> >                        myResultsFeed = myService.Query(myQuery);
> >                    }
> >                    catch
> >                    {
> >                        // Probably a permission error
> >                        Response.Write(keyword.FullKeyword + "Failed
> > to read calendar " + feedUrl);
> >                    }
>
> >                    foreach (Google.GData.Calendar.EventEntry entry in
> > myResultsFeed.Entries)
> >                    {
> >                        string content = entry.Content.Content == "" ?
> > entry.Title.Text : entry.Content.Content;
>
> >                        foreach (When time in entry.Times)
> >                        {
> >                            DateTime start = time.StartTime;
>
> >                            foreach (Reminder reminder in
> > entry.Reminders)
> >                            {
>
> >                                if (reminder.Method ==
> > Reminder.ReminderMethod.alert)
> >                                {
> >                                    DateTime remindertime =
> > start.AddDays(-1 * reminder.Days).AddHours(-1 *
> > reminder.Hours).AddMinutes(-1 * reminder.Minutes);
>
> >                                    // Only add reminders that occur
> > today
> >                                    if (remindertime.ToShortDateString
> > () == DateTime.Now.ToShortDateString())
> >                                    {
>
> >                                        Response.Write
> > (keyword.FullKeyword + "\t" + remindertime.ToString() + "\t" +
> > content);
> >                                    } // if reminder is today
> >                                } // if reminder method is alert
> >                            } // foreach reminder
> >                        } // foreach time
> >                    } // foreach entry
> >                } // if keyword.GoogleCalendar exists
> >            } // foreach keyword
>
> >            return;
> >        }
>
> > On Dec 9, 4:20 pm, "Ray Baxter" <[EMAIL PROTECTED]> wrote:
> >> Could you elaborate?
>
> >> It is unclear what you code returns and what you expect it to return.
> >> Plus your code seems to have cut off prematurely. There are unclosed
> >> loops and the last loop appears to be empty.
>
> >> Thanks,
>
> >> Ray
>
> >> On Tue, Dec 9, 2008 at 10:43 AM, Travis <[EMAIL PROTECTED]> wrote:
>
> >> > 1. Create calendar
> >> > 2. Create a daily recurring event "Test"
> >> > 3. Use the following code:
>
> >> > EventQuery myQuery = new EventQuery(feedUrl);
> >> > myQuery.StartTime = new DateTime(DateTime.Now.Year,
> >> > DateTime.Now.Month, DateTime.Now.Day);
>
> >> > EventFeed myResultsFeed = myService.Query(myQuery);
>
> >> > foreach (Google.GData.Calendar.EventEntry entry in
> >> > myResultsFeed.Entries)
> >> > {
> >> > foreach (When time in entry.Times)
> >> >                {
> >> >                    DateTime start = time.StartTime;
>
> >> >                    foreach (Reminder reminder in entry.Reminders)- Hide 
> >> > quoted text -
>
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

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