Hi,

First I defined a simple class which represents a calendar (this is
part of a Google Calendar / Outlook sync application)

It begins like this:

    class Calendar
    {
        public event SyncEventHandler OnSyncEvent;

        private string title;
        private string googleUrl;
        private bool sync;

        public Calendar()
        {
            //Default
        }

       //continues here

Then I have a static method which retreives all calendars:
       public static List<Calendar> GetAllFromGoogle()
        {
            //Create a new list
            List<Calendar> calendars = new List<Calendar>();

            //Get the calendars
            FeedQuery query = new FeedQuery("http://www.google.com/
calendar/feeds/default");
            AtomFeed calendarFeed;

            calendarFeed = GoogleManager.Service.Query(query);

            foreach (AtomEntry entry in calendarFeed.Entries)
            {
                Calendar calendar = new Calendar();
                calendar.title = entry.Title.Text;
                calendar.googleUrl = entry.Links[0].AbsoluteUri;
                calendar.sync = false;

                calendars.Add(calendar);
            }

            return calendars;
        }

This basically retreives a List<Calendar>

In order to fetch Appointments from a calendar, I defined a normal
method for the Calendar class:

        public List<AppointmentItem> GetAllAppointmentsFromGoogle()
        {
            List<AppointmentItem> googleItems = new
List<AppointmentItem>();

            EventQuery query = new EventQuery(this.googleUrl);
            EventFeed googleEntries =
GoogleManager.Service.Query(query);

            foreach (EventEntry entry in googleEntries.Entries)
            {
                AppointmentItem appointment =
(AppointmentItem)OutlookManager.Outlook.CreateItem(OlItemType.olAppointmentItem);
                appointment.ItemProperties.Add("googleid",
OlUserPropertyType.olText, null, null).Value = entry.Id.Uri.Content;
                appointment.ItemProperties.Add("calendarurl",
OlUserPropertyType.olText, null, null).Value = this.googleUrl;
                appointment.ItemProperties.Add("googleupdated",
OlUserPropertyType.olDateTime, null, null).Value = entry.Updated;
                appointment.ItemProperties.Add("googleediturl",
OlUserPropertyType.olText, null, null).Value = (entry.EditUri !=
null ? entry.EditUri.Content : "");


                if (entry.Times.Count > 0)
                {
                    appointment.Start = entry.Times[0].StartTime;
                    appointment.End = entry.Times[0].EndTime;

                    appointment.Body = entry.Summary.Text;
                    appointment.Subject = entry.Title.Text;

                    if (entry.Locations.Count > 0)
                        appointment.Location =
entry.Locations[0].ValueString;


                    googleItems.Add(appointment);

                }
                else
                {
                    //Recurring event... need to add support
                }

            }

            return googleItems;
        }

In this case, it retreives all Google Appointments as Outlook
Appointments (classes provided by Microsoft)

This should be all you need to retreive all appointments for all your
calendars, including calendars people
have shared with you.

Is this what you are looking for?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to google-help-dataapi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to