GetCalendarReport Method

Generates a report on the indicated calendar collection resource.

Syntax

public void getCalendarReport(String resourceURI);

Remarks

This method is used to send a calendar-query request to the calendar located at the specified ResourceURI. The ReportFilter can be used to filter out and return only the calendar events you wish to receive. The response to a calendar-query report will be parsed by the class, and information about the individual events contained within shall be fired in the EventDetails event.

The following properties are used when creating a request with PutCalendarEvent or ExportICS, and will be filled after calling GetCalendarEvent or ImportICS. These will also be available from inside the EventDetails event, which is fired for each event received from the CalDAV server in response to a GetCalendarReport.

For example:

  CalDAV.User = "myusername";
  CalDAV.Password = "mypassword";
  CalDAV.ReportFilter.StartDate = "20090101T000000Z";
  CalDAV.ReportFilter.EndDate = "20091231T230000Z";
  CalDAV.GetCalendarReport("https://caldav.calendar.yahoo.com/dav/username/Calendar/default_calendar/");
The following code inside the EventDetails event will print the start and end time as well as the summary for each event:
  void CalDAV_OnEventDetails(object sender, CaldavsEventDetailsEventArgs e) {
	  Console.WriteLine(CalDAV.Summary + ": " + CalDAV.StartDate + " to " + CalDAV.EndDate);
    
  }
The output from the above code will look something like this:
	Carolina Hurricanes vs. Colorado Avalanche: 20090222T150000 to 20090222T180000
	Lone Rider Brewery Tour: 20091107T124500 to 20091107T134500
	Salsa Dancing: 20090927T154500 to 20090927T181500
	Superbowl Party: 20090201T170000 to 20090202T000000
	Kathy's Birthday: 20090608T010000 to 20090608T020000
	Dinner at Shannon's: 20091001T183000 to 20091001T203000
	Carolina Rollergirls match: 20090411T170000 to 20090411T180000

There is no standard format for resource URIs. Google for instance, uses "https://www.google.com/calendar/dav/" plus your email address to access the default calendar. So "https://www.google.com/calendar/dav/username@gmail.com/" is the base URI for the default calendar. If you have multiple calendars, replace the email address portion above with the Id of the calendar, plus "@group.calendar.google.com/". For instance: "https://www.google.com/calendar/dav/ev3nkr4ua83jej7q32oumn5eeo@group.calendar.google.com/". For Google, calendar events are stored in the "/events/" path. To retrieve a report on a calendar, you'd add "/events/" to one of the above paths. For example:

  CalDAV.GetCalendarReport("https://www.google.com/calendar/dav/username@gmail.com/events/");
Leaving the "/events/" out of the URI will result in an HTTP protocol error: 405 Method not allowed.

To add or retrieve an event, add the UID of the event you're creating or retrieving plus ".ics" to the path. Note that when putting an event with the PutCalendarEvent method, if the resourceURI and the UID do not match Google will create the event using the UID stored in the UID property. The actual location of will be newly added event will be returned in a "Location" header. This is the resource URI you must use to retrieve the event with GetCalendarEvent. For example:

  CalDAV.UID = "1234567890";
  CalDAV.PutCalendarEvent("https://www.google.com/calendar/dav/username@gmail.com/events/1234567890.ics");

Yahoo uses a different format for CalDAV access. Yahoo's ResourceURIs always start with "https://caldav.calendar.yahoo.com/dav/" plus your user name, plus "/Calendar/" plus the name of your calendar. For instance: "https://caldav.calendar.yahoo.com/dav/username/Calendar/Your_Name" for the default calendar. (Yahoo uses your name to create the default calendar). When using the CreateCalendar event to create a new calendar, replace "Your_Name" in the URI with the desired name of your new calendar. Event resources are located directly under the "/Calendar/Calendar_Name/" path. Like Google, the UID and filename portion of the resource URI must match, but Yahoo will actually return an HTTP protocol error if they differ. The examples below show a few possible transactions:

  CalDAVS1.User = "username";
  CalDAVS1.Password = "password";
  
  CalDAV.DisplayName = "My Hockey Calendar";
  CalDAV.CreateCalendar("https://caldav.calendar.yahoo.com/dav/username/Calendar/Hockey_Calendar/");
  
  CalDAV.StartDate = "20100401T040000";
  CalDAV.EndDate = "20100401T060000";
  CalDAV.UID = "qwerty1234567";
  CalDAV.Summary = "First Practice";
  CalDAV.Location = "Rink on 1st and main";
  CalDAV.EventType = vEvent;
  CalDAV.PutCalendarEvent("https://caldav.calendar.yahoo.com/dav/username/Calendar/Hockey_Calendar/qwerty1234567.ics");
  
  CalDAV.GetCalendarReport("https://caldav.calendar.yahoo.com/dav/username/Calendar/Hockey_Calendar/");

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 Java Edition - Version 20.0 [Build 8307]