What Is an Appointment
- 4 minutes to read
This document introduces the Appointment concept, describes the types of appointments, as well as their interaction with the Appointment Storage.
#Appointment Overview
An appointment represents a time interval and the end-user activity scheduled for this time interval. An activity is characterized by its subject, location, indicators (labels and statuses), and description. Any number of custom properties can also be defined for an appointment. Appointments can be recurring, which means that an activity can be scheduled for repetitive time intervals.
A single appointment is represented via the Appointment object. What an appointment looks like depends upon the active View, which is used to show data within the scheduler. The picture below illustrates an appointment viewed using the Day View of a Scheduler control.
Appointments are stored in an AppointmentStorage, which is a part of a Scheduler Storage and can be accessed via the SchedulerStorage.AppointmentStorage property. The collection of all appointments is accessible via the AppointmentStorage.Items property.
The Appointment Storage allows the appointment data to persist in a data source, and appointments to be assigned to particular resources.
#Types of Appointments
Every appointment is of a particular type, which can be accessed via its Appointment.Type property. For example, a simple non-recurring appointment type is AppointmentType.Normal. All appointment types are listed by the AppointmentType enumeration's members.
The following diagram illustrates the difference between recurring and non-recurring appointment types.
To learn more about recurring appointments and their types, see the Recurring Appointments and Exceptions document.
#Manage Appointments
Create Appointments
To create an appointment in code, use the SchedulerStorage.CreateAppointment method. This method creates an appointment with default attribute settings and custom fields. You should specify them via code, and add an appointment to the AppointmentStorage using its AppointmentStorage.Add method. To get an example on how to programmatically create recurring appointments with different periodicity and number of occurrences, refer to How to: Create Appointments with Various Recurrence Types Programmatically.
To specify default appointment properties, which should be applied to all newly created appointments, handle the SchedulerControl.InitNewAppointment event. To get an example of using this event, see the How to: Set Default Values for a New Appointment document.
Modify Appointments
To control changes applied to an appointment, use the SchedulerStorage.AppointmentChanging event, which is fired before the changed appointment is saved to the storage, as well as the SchedulerStorage.AppointmentsChanged and SchedulerStorage.AppointmentsInserted events that are raised after modifications are applied.
Appointment attributes can be changed via the corresponding properties of the Appointment object. Custom properties are accessible via the CustomFields property using index notation.
Selected appointments are contained within the SchedulerControl.SelectedAppointments collection. To track selection changes, you can subscribe to the SchedulerControl.SelectedAppointments.CollectionChanged event. The How to: Obtain the Selected Appointments document demonstrates how to get access to the selected appointments.
Delete Appointments
Non-recurring appointments can be deleted without confirmation, so handle the SchedulerStorage.AppointmentDeleting event to prevent accidental deletion.
To delete an appointment in code, use the Appointment.Delete method.
Before the actual deletion is accomplished, the SchedulerStorage.AppointmentDeleting event is raised for each object being deleted. You can handle the event to specify the desired disposition of each appointment. After an appointment is deleted, the SchedulerStorage.AppointmentsDeleted event occurs.
#End-User Restrictions
By default, all appointment operations (copying, deleting, dragging, etc.) are enabled for end-users. But in some cases, it may be necessary to prevent end-users from modifying appointments shown within the Scheduler Control.
You can restrict certain appointment operations using the set of properties (named AlowAppointment*) of the OptionsCustomization object accessed via SchedulerControl.OptionsCustomization. UsedAppointmentType enumeration members are used by the OptionsCustomization.AlowAppointment* properties to specify the types of appointments that can be used in end-user restrictions.
If you set one of the OptionsCustomization.Allow* properties to UsedAppointmentType.Custom, a related SchedulerControl.Allow* event will fire, in which you can decide how to handle a particular case.
For example, to restrict appointment deletion, you can use the OptionsCustomization.AllowAppointmentDelete property and SchedulerControl.AllowAppointmentDelete event.
For more information, see the How to: Set End-User Restrictions document.