CalDAV Class
Properties Methods Events Configuration Settings Errors
The CalDAV Component implements an easy-to-use interface to the Calendaring Extensions to the Web Distributed Authoring and Versioning protocol (WebDAV). In this manner the CalDAV protocol specifies a standard way of accessing, managing, and sharing calendaring and scheduling information based on the iCalendar format.
Class Name
IPWorks_CalDAV
Procedural Interface
ipworks_caldav_open(); ipworks_caldav_close($res); ipworks_caldav_register_callback($res, $id, $function); ipworks_caldav_get_last_error($res); ipworks_caldav_get_last_error_code($res); ipworks_caldav_set($res, $id, $index, $value); ipworks_caldav_get($res, $id, $index); ipworks_caldav_do_addcookie($res, $cookiename, $cookievalue); ipworks_caldav_do_addcustomproperty($res, $varname, $varvalue); ipworks_caldav_do_config($res, $configurationstring); ipworks_caldav_do_copycalendarevent($res, $sourceresourceuri, $destinationresourceuri); ipworks_caldav_do_createcalendar($res, $resourceuri); ipworks_caldav_do_deletecalendarevent($res, $resourceuri); ipworks_caldav_do_doevents($res); ipworks_caldav_do_exportics($res); ipworks_caldav_do_getcalendarevent($res, $resourceuri); ipworks_caldav_do_getcalendaroptions($res, $resourceuri); ipworks_caldav_do_getcalendarreport($res, $resourceuri); ipworks_caldav_do_getfreebusyreport($res, $resourceuri); ipworks_caldav_do_importics($res, $calendardata); ipworks_caldav_do_interrupt($res); ipworks_caldav_do_lockcalendar($res, $resourceuri); ipworks_caldav_do_movecalendarevent($res, $sourceresourceuri, $destinationresourceuri); ipworks_caldav_do_putcalendarevent($res, $resourceuri); ipworks_caldav_do_reset($res); ipworks_caldav_do_unlockcalendar($res, $resourceuri);
Remarks
The class allows remote management of calendar events and collections of events (the calendar itself), including creation, deletion, listing, copying, and moving. Resource locking is also supported.
The GetCalendarReport method will list the event resources contained in the calendar, and the ReportFilter can be used to limit the results returned. The EventDetails event will be fired for each matching calendar resource. You may also request a report containing a list of times that the owner is free or busy using the GetFreeBusyReport. The FreeBusy event will fire for each entry received, and the data fired in the event will also be stored in the FreeBusy property.
Single events can be added to a calendar (or updated) using the PutCalendarEvent method, and can be retrieved via the GetCalendarEvent method. Events may be copied or moved with the CopyCalendarEvent and MoveCalendarEvent.
Depth is used to determine which resources or properties are retrieved from the server. A depth of ResourceOnly will return only the resource associated with ResourceURI, or its properties. A depth of Infinity will return all resources contained within hierarchy, or their collective properties.
Note: Some servers (such as IIS 7.5) may not support a depth of Infinity by default and may return a HTTP 403 Forbidden response.
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.
- Alarms
- Attendees
- Categories
- Classification
- Completed
- Created
- CustomProperties
- Depth
- Description
- DisplayName
- Duration
- EndDate
- EventType
- LastModified
- Location
- Organizer
- Priority
- Recurrence
- Sequence
- StartDate
- Status
- Summary
- Timestamp
- Timezone
- Transparency
- UID
- URL
Each method that acts on the calendar takes a ResourceURI parameter, which points to either an event resource or to the calendar itself. Event resources have a URI that ends with a filename and the ".ics" extension. Calendar resources end in a directory path. The following methods all act on events, and thus their ResourceURI parameters must terminate in a filename with the ".ics" extension:
These methods all act upon the calendar collection resource (the calendar itself): The LockCalendar and UnLockCalendar methods may operate on individual events or on the whole calendar.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/");
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
AlarmCount | The number of records in the Alarm arrays. |
AlarmAction | This property determines what the CalDAV server will do when the alarm Trigger is reached. |
AlarmAttachment | This property contains a sound file attached to the alarm. |
AlarmAttachmentType | This property contains the MIME-Type of the attachment. |
AlarmDuration | This property contains the interval between repeating alarms. |
AlarmMessage | This property contains a message used to alert the user when this alarm is triggered. |
AlarmRecipient | This property contains the email address of the person to be alerted when this alarm is triggered. |
AlarmRepeat | This property contains the number of times the alarm is to be repeated after the initial trigger. |
AlarmSubject | This property contains the subject of the message used to alert the user when this alarm is triggered. |
AlarmTrigger | This property contains the time when the alarm is triggered. |
Attendees | Defines one or more participants that have been invited to the event. |
Authorization | The Authorization string to be sent to the server. |
AuthScheme | The authentication scheme to use when server authorization is required. |
Categories | Used to specify categories or subtypes of the calendar event. |
Classification | Defines the access classification for a calendar component. |
Completed | Date and time that a to-do was actually completed. |
Connected | Shows whether the component is connected. |
CookieCount | The number of records in the Cookie arrays. |
CookieDomain | The domain of a received cookie. |
CookieExpiration | This property contains an expiration time for the cookie (if provided by the server). |
CookieName | The name of the cookie. |
CookiePath | This property contains a path name to limit the cookie to (if provided by the server). |
CookieSecure | This property contains the security flag of the received cookie. |
CookieValue | This property contains the value of the cookie. |
Created | Date and time calendar information created. |
CustomPropertyCount | The number of records in the CustomProperty arrays. |
CustomPropertyAttribute | This property contains an optional attribute of the custom property. |
CustomPropertyName | This property contains the textual name of the custom property. |
CustomPropertyValue | This property contains the value of the custom property. |
Depth | The depth associated with the current operation. |
Description | Provides a complete description of the calendar event. |
DisplayName | Provides the display name of the calendar being created. |
Duration | Duration of the calendar event. |
EndDate | Specifies the date and time that a calendar event ends. |
ETag | Identifier returned by the CalDAV server which is used to synchronize edits. |
EventType | Indicates the type of calendar object resource. |
FirewallAutoDetect | This property tells the component whether or not to automatically detect and use firewall system settings, if available. |
FirewallType | This property determines the type of firewall to connect through. |
FirewallHost | This property contains the name or IP address of firewall (optional). |
FirewallPassword | This property contains a password if authentication is to be used when connecting through the firewall. |
FirewallPort | This property contains the TCP port for the firewall Host . |
FirewallUser | This property contains a user name if authentication is to be used connecting through a firewall. |
FollowRedirects | Determines what happens when the server issues a redirect. |
FreeBusyCount | The number of records in the FreeBusy arrays. |
FreeBusyRange | Contains the date/time range when the calendar owner is busy. |
FreeBusyType | Indicates the busy status of the corresponding BusyRange . |
Idle | The current status of the component. |
LastModified | The date and time that the information associated with the calendar event was last revised in the calendar store. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
Location | Defines the intended venue for the activity defined by a calendar component. |
LockType | The type of the current resource lock. |
LockOwner | The principle that owns the current resource lock. |
LockScope | The scope of the current resource lock. |
LockTimeout | The time to live for the current resource lock. |
LockTokens | The lock string to be used when submitting operations on a locked resource. |
Organizer | Defines the organizer of a calendar event. |
OtherHeaders | Other headers as determined by the user (optional). |
ParsedHeaderCount | The number of records in the ParsedHeader arrays. |
ParsedHeaderField | This property contains the name of the HTTP header (same case as it is delivered). |
ParsedHeaderValue | This property contains the header contents. |
Password | A password if authentication is to be used. |
Priority | Defines the relative priority for a calendar event. |
ProxyAuthScheme | This property is used to tell the component which type of authorization to perform when connecting to the proxy. |
ProxyAutoDetect | This property tells the component whether or not to automatically detect and use proxy system settings, if available. |
ProxyPassword | This property contains a password if authentication is to be used for the proxy. |
ProxyPort | This property contains the TCP port for the proxy Server (default 80). |
ProxyServer | If a proxy Server is given, then the HTTP request is sent to the proxy instead of the server otherwise specified. |
ProxyUser | This property contains a user name, if authentication is to be used for the proxy. |
RecurrenceDates | Individual dates on which the event will recur. |
RecurrenceExceptionDates | Defines the list of DATE-TIME exceptions to the recurrence set. |
RecurrenceExceptionRule | Defines a rule or repeating pattern for an exception to the recurrence set. |
RecurrenceId | Identifies a recurring event. |
RecurrenceRule | This property defines the recurrence rule for the event. |
ReportFilterAlarmEnd | Limits the events returned in the report to only those with an alarm set in the range specified by AlarmStart and AlarmEnd . |
ReportFilterAlarmStart | Limits the events returned in the report to only those with an alarm set in the range specified by AlarmStart and AlarmEnd . |
ReportFilterCustomFilter | Allows the user to specify his own filter XML. |
ReportFilterEndDate | Limits the events returned in the report to only those which occur in the time range specified by StartDate and EndDate . |
ReportFilterEventType | Indicates the type of calendar object resources to return in a Report. |
ReportFilterProperty | Limits the events returned in a Report to only those which contain a matching property name and value. |
ReportFilterRecurEnd | Limits the recurring events returned in the report. |
ReportFilterRecurStart | Limits the recurring events returned in the report. |
ReportFilterReturnCalendarData | Controls whether the contents of each calendar event is returned in the report. |
ReportFilterStartDate | Limits the events returned in the report to only those which occur in the time range specified by StartDate and EndDate . |
ReportFilterUID | Limits the recurring events returned in the report to only those with the specified UID. |
Sequence | Defines the revision sequence number of the event within a sequence of revisions. |
StartDate | Specifies the date and time that an event begins. |
Status | Defines the overall status or confirmation for the calendar event. |
StatusLine | The first line of the last server response. |
Summary | Defines a short summary or subject for the calendar event. |
Timeout | A timeout for the component. |
Timestamp | Specifies the date and time that the instance of the event was created. |
TimezoneDSTName | The customary name for the daylight-savings time zone. |
TimezoneDSTOffsetFrom | The UTC offset that is in use when the onset of this time zone observance begins. |
TimezoneDSTOffsetTo | The UTC offset for daylight savings time, when this observance is in use. |
TimezoneDSTRule | This property defines the recurrence rule for the onset of this daylight savings time observance. |
TimezoneDSTStart | The effective onset date and local time for the daylight-time time zone definition. |
TimezoneLastModified | This optional property is a UTC value that specifies the date and time that this time zone definition was last updated. |
TimezoneStdName | The customary name for the standard time zone. |
TimezoneStdOffsetFrom | The UTC offset that is in use when the onset of this time zone observance begins. |
TimezoneStdOffsetTo | The UTC offset for standard time, when this observance is in use. |
TimezoneStdRule | This property defines the recurrence rule for the onset of this standard time observance. |
TimezoneStdStart | The effective onset date and local time for the standard-time time zone definition. |
TimezoneId | This property specifies a text value that uniquely identifies this CalTimezone calendar component. |
TimezoneURL | Optionally points to a published time zone definition. |
Transparency | Defines whether or not an event is transparent to busy time searches. |
UID | A persistent, globally unique identifier for the calendar event. |
URL | Location of the event resource on the CalDAV server. |
User | A user name if authentication is to be used. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
AddCookie | Adds a cookie and the corresponding value to the outgoing request headers. |
AddCustomProperty | Adds a form variable and the corresponding value. |
Config | Sets or retrieves a configuration setting . |
CopyCalendarEvent | Copy events to a new location. |
CreateCalendar | Creates a new calendar collection resource. |
DeleteCalendarEvent | Delete a resource or collection. |
DoEvents | Processes events from the internal message queue. |
ExportICS | Generates an event from the properties in the iCal (.ICS) format. |
GetCalendarEvent | Retrieves a single event from the CalDAV server. |
GetCalendarOptions | Retrieves options for the ResourceURI to determines whether it supports calendar access. |
GetCalendarReport | Generates a report on the indicated calendar collection resource. |
GetFreeBusyReport | Generates a report as to when the calendar owner is free and/or busy. |
ImportICS | Imports iCal data (contained in an ICS file) into the component's property list. |
Interrupt | Interrupt the current method. |
LockCalendar | Obtain a lock for a specified calendar resource. |
MoveCalendarEvent | Moves one calendar resource to a new location. |
PutCalendarEvent | Adds a calendar resource at the specified ResourceURI using the CalDAV PUT method. |
Reset | Reset the component. |
UnLockCalendar | Unlocks a calendar resource. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Connected | Fired immediately after a connection completes (or fails). |
ConnectionStatus | Fired to indicate changes in connection state. |
Disconnected | Fired when a connection is closed. |
EndTransfer | Fired when a document finishes transferring. |
Error | Information about errors during data delivery. |
EventDetails | Fires for each calendar event received. |
FreeBusy | Fires for each Free/Busy element received in the response. |
Header | Fired every time a header line comes in. |
Redirect | Fired when a redirection is received from the server. |
SetCookie | Fired for every cookie set by the server. |
StartTransfer | Fired when a document starts transferring (after the headers). |
Status | Fired when the HTTP status line is received from the server. |
Transfer | Fired while a document transfers (delivers document). |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
AuthScheme | The authentication scheme to use for server authorization. |
BuildEvent | Builds the current event for a multi-event calendar entry. |
DueDate | Specifies the due date for a calendar event. |
EndCalendar | Signifies the end of a multi-event calendar entry. |
ExpandRecurringEvents | Instructs the component to return all instances of a recurring event within a timeframe. |
ProductId | Specifies the identifier for the product that created the iCalendar object. |
RecurrenceExceptionDatesAttrs | Specifies the attributes for the exception dates of a recurring event. |
StartCalendar | Signifies the beginning of a multi-event calendar entry. |
EncodeURL | If set to true the URL will be encoded by the component. |
AcceptEncoding | Used to tell the server which types of content encodings the client supports. |
AllowHTTPCompression | This property enables HTTP compression for receiving data. |
AllowIdenticalRedirectURL | Allow redirects to the same URL. |
Append | Whether to append data to LocalFile. |
Authorization | The Authorization string to be sent to the server. |
BytesTransferred | Contains the number of bytes transferred in the response data. |
EncodeURL | If set to true the URL will be encoded by the component. |
FollowRedirects | Determines what happens when the server issues a redirect. |
GetOn302Redirect | If set to true the component will perform a GET on the new location. |
HTTPVersion | The version of HTTP used by the component. |
IfModifiedSince | A date determining the maximum age of the desired document. |
KeepAlive | Determines whether the HTTP connection is closed after completion of the request. |
MaxRedirectAttempts | Limits the number of redirects that are followed in a request. |
OtherHeaders | Other headers as determined by the user (optional). |
ProxyAuthorization | The authorization string to be sent to the proxy server. |
ProxyAuthScheme | The authorization scheme to be used for the proxy. |
ProxyPassword | A password if authentication is to be used for the proxy. |
ProxyPort | Port for the proxy server (default 80). |
ProxyServer | Name or IP address of a proxy server (optional). |
ProxyUser | A user name if authentication is to be used for the proxy. |
TransferredDataLimit | The maximum number of incoming bytes to be stored by the component. |
TransferredHeaders | The full set of headers as received from the server. |
UseChunkedEncoding | Enables or Disables HTTP chunked encoding for transfers. |
ChunkSize | Specifies the chunk size in bytes when using chunked encoding. |
UserAgent | Information about the user agent (browser). |
KerberosSPN | The Service Principal Name for the Kerberos Domain Controller. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the component whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The TCP port in the local host where the component binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
RecordLength | The length of received data records. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
UseIPv6 | Whether to use IPv6. |
TcpNoDelay | Whether or not to delay when sending packets. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
CodePage | The system code page used for Unicode to Multibyte translations. |