I just make a simple Windows Application to retrive all of my
calendars.
I write the following code
string calendarALL = "http://www.google.com/calendar/feeds/default/
allcalendars/full";
.
.
.
CalendarService service = new CalendarService( "CalendarSampleApp" );
.
.
try
{
EventFeed calFeed = service.Query( query ) as EventFeed;
.
.
.
}
catch( Google.GData.Client.GDataRequestException gg )
{
}
My point is.. How can I retrive my all calendars ???
Sending a query to
http://www.google.com/calendar/feeds/default/owncalendars/full
will give you a list of calendars owned by you.
Then you can use
// Create the query object:
EventQuery query = new EventQuery();
query.Uri = new
Uri("http://www.google.com/calendar/feeds/j...@gmail.com/private/full");
// Tell the service to query:
EventFeed calFeed = service.Query(query);
For each calendar url you retreived.
This is all documented in
http://code.google.com/apis/calendar/developers_guide_dotnet.html
I'll be in the office in a few hours, if you need some sample code
I should be able to send it to you then.
Timothy.
Yes I want Sample code.....
I want to retrive all the calendar whichever I added in my
Calendar....
so that I use
string calendarALL = "http://www.google.com/calendar/feeds/default/
allcalendars/full";
by using ur code I can retrive only shared calendars and not public
calendar I added
Thanks for the Help..............
On Nov 13, 3:38 pm, "Timothy Parez" <timoth...@gmail.com> wrote:
> The query above should give you a list of all your calendars
> including calendars people have shared with you.
>
> Sending a query tohttp://www.google.com/calendar/feeds/default/owncalendars/full
> will give you a list of calendars owned by you.
>
> Then you can use
>
> // Create the query object:
> EventQuery query = new EventQuery();
> query.Uri = new
> Uri("http://www.google.com/calendar/feeds/j...@gmail.com/private/full");
>
> // Tell the service to query:
> EventFeed calFeed = service.Query(query);
>
> For each calendar url you retreived.
> This is all documented inhttp://code.google.com/apis/calendar/developers_guide_dotnet.html
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?