Example #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // This function reads an appointment from the Calendar
        //
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public static void AppointmentTest(NetMAPI mapi)
        {
            if (mapi.OpenCalendar() && mapi.GetContents())
            {
                mapi.SortContents(false, SortFields.SORT_RECEIVED_TIME);

                MAPIAppointment appointment;
                StringBuilder strText = new StringBuilder(NetMAPI.DefaultBufferSize);
                if (mapi.GetNextAppointment(out appointment))
                {
                    if (appointment.GetSubject(strText)) Console.WriteLine("Subject: " + strText);
                    if (appointment.GetLocation(strText)) Console.WriteLine("Location: " + strText);
                    if (appointment.GetStartTime(strText)) Console.WriteLine("Start Time: " + strText);
                    if (appointment.GetEndTime(strText)) Console.WriteLine("End Time: " + strText);

                    appointment.Dispose();
                }
            }
        }