Creating a Recurring Appointment (Windows CE 5.0)

Send Feedback

The following Visual C++ code example shows you how to create a recurring appointment. This appointment will occur every Monday at 10:00 AM. Microsoft assumes you already have an Application object and have logged on.

IAppointment *pAppt;
IRecurrencePattern *pRec;
SYSTEMTIME st;
DATE date;

// Call CreateItem to create an item directly from the Application object.
polApp->CreateItem (olAppointmentItem, (IDispatch**)&pAppt);

// Convert Monday, 4/5/99 at 10:00 am to a DATE
memset (&st, 0, sizeof (SYSTEMTIME));
st.wMonth = 4;
st.wDay   = 5;
st.wYear  = 1999;
st.wHour  = 10;

// Note the use of the SystemTimeToVariantTime method in the 
// Application object. Because it is not defined on Palm-size
// PC version 1.0, this is necessary for the code to compile for
// that OS. If you will not be compiling this code on that
// OS, call SystemTimeToVariantTime directly.
polApp->SystemTimeToVariantTime (&st, &date);

// Set the subject and the start date to 10:00 am
pAppt->put_Subject (TEXT ("Recurring Appointment"));
pAppt->put_Start (date);

// Now, set the RecurrencePattern
pAppt->GetRecurrencePattern (&pRec);
pRec->put_RecurrenceType (olRecursWeekly);
pRec->put_DayOfWeekMask (olMonday);
pRec->put_NoEndDate (VARIANT_TRUE);

// And save the appointment
pAppt->Save ();

// Release objects
pRec->Release ();
pAppt->Release ();

The following Visual Basic code example shows you how to create a recurring appointment.

' olAppointmentItem is replaced with 1
Set pAppt = polApp.CreateItem (1)
pAppt.Subject = "Recurring Appointment"
pAppt.Start = #4/5/1999 10:00 AM#

' olRecursWeekly is replaced with 1 and olMonday is replaced with 2.
Set pRec = pAppt.GetRecurrencePattern
pRec.RecurrenceType = 1
pRec.DayOfWeekMask = 2
pRec.NoEndDate = True
' Save the appointment
pAppt.Save

See Also

Pocket Outlook Object Model Code Examples | Pocket Outlook Object Model Application Development

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.