Hello.
I have main calendar([email protected]) and calendar of holidays.
I want receive events, sorted by calendar name.

//Create service
CalendarService service = new CalendarService("CalendarSampleApp");
string userName = this.UserName.Text;
string passWord = this.Password.Text;
 if (userName != null && userName.Length > 0)
            {
                service.setUserCredentials(userName, passWord);
            }
//Create Calendar query
CalendarQuery query = new CalendarQuery();
query.Uri = new 
Uri("https://www.google.com/calendar/feeds/default/allcalendars/full";);
//Get all calendars
CalendarFeed resultFeed = (CalendarFeed)service.Query(query);
// Get info from each calendar
 foreach (CalendarEntry entry in resultFeed.Entries)
            {
                listBox1.Items.Add(entry.Title.Text);
                //Get calendar events
                var calUri = entry.Content.Src.Content;
                var q = new EventQuery(calUri);
                q.EndTime = DateTime.Now.AddMonths(2);
                q.StartTime = DateTime.Now.AddMonths(-2);
                //Request events
                EventFeed feeds = service.Query(q) as EventFeed;

                while (feeds != null && feeds.Entries.Count > 0)
                {
                    // Display events info
                    foreach (EventEntry eventEntry in feeds.Entries)
                    {
                        this.richTextBox1.AppendText(entry.Title.Text + " " 
+ 
                            eventEntry.Times[0].StartTime.ToString() + " " 
+ 
                            eventEntry.Title.Text + "\r\n" );
                    }

                    if (feeds.NextChunk != null)
                    {
                        q.Uri = new Uri(feeds.NextChunk);
                        feeds = service.Query(q);
                    }
                    else
                    {
                        feeds = null;
                    }
                }
This code work fine. BUT!
With events of my main calendar i got all events from "holiday" calendar. 
And with "holiday" calendar i got all holiday events.
What i doing wrong?


-- 
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://code.google.com/apis/calendar/community/forum.html

Reply via email to