Skip to main content
This demonstrates how to create recurring appointments using NetServer services. In the following example, we will be creating an appointment at 2.00 P.M. tomorrow that will recur for the next 8 working days.

Code

CS

Walk-through

In creating a recurring appointment, first, an appointment is created and then the recurrence information has to be set according to the requirement. In the above code, we have created an AppointmentAgent, which we then use to create a new AppointmentEntity. Next, the appointment text, contact, and duration are set. The recurrence information is specified by creating a recurrence pattern. Here, we want the appointment to recur daily for 8 days starting from tomorrow. Thus the recurrence pattern is set to Daily and further specified as EveryWorkday. RecurrencePattern and RecurrenceDailyPattern are enumerations.
CS
Because it should recur for 8 working days, we cannot specify an end date directly. Instead, the number of recurrences is set to 8 and the recurrence end date is calculated based on the number of recurrences:
CS
Next, the recurrence pattern is created using the CalculateDays method of the agent. Finally, the recurrence information is assigned to the AppointmentEntity and the appointment is saved to the database. Get the source code (zip)