DateTime startDate=DateTime. Now;
DateTime endDate=startDate. AddDays (30);
Const int NUM_APPTS=5;
CalendarFolder calendar=CalendarFolder. Bind (service, WellKnownFolderName calendar, the new PropertySet ());
CalendarView cView=new CalendarView (startDate, endDate, NUM_APPTS);
The cView. PropertySet=new PropertySet (AppointmentSchema. Subject, AppointmentSchema. Start, AppointmentSchema End);
FindItemsResults appointments=calendar. FindAppointments (cView);
Console. WriteLine (" \ nThe first "+ NUM_APPTS +" appointments on your calendar from "+ startDate. Date. ToShortDateString () +
"To" + endDate. Date. ToShortDateString () + "are: \ n");
Foreach (the Appointment a in appointments)
{
The Console. Write (" Subject: "+ a.S ubject. The ToString () +" ");
The Console. Write (" Start: "+ a.S tart. The ToString () +" ");
The Console. Write (" End: "+ a.E nd. The ToString ());
Console. WriteLine ();
}