Code Example: Creating a Recurring Appointment (Windows Embedded CE 6.0)
1/6/2010
The following Visual C++ code example demonstrates how to create a recurring appointment. This appointment will occur every Monday at 8:30 PM.
Note
It is assumed that you have already created an IPOutlookApp object, and have logged onto a POOM session. To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
IAppointment * pAppt;
IRecurrencePattern * pRec;
DATE date;
SYSTEMTIME st;
// Call CreateItem to create an item directly from the Application object.
polApp->CreateItem(olAppointmentItem, (IDispatch**)&pAppt);
// Convert Monday, 5/10/2007 at 8:30 PM, to a DATE object.
memset (&st, 0, sizeof(SYSTEMTIME));
st.wMonth = 5;
st.wDay = 10;
st.wYear = 2007;
st.wHour = 20.5;
polApp->SystemTimeToVariantTime(&st, &date);
// Set the subject and the start date.
pAppt->put_Subject (TEXT("Recurring Appointment"));
pAppt->put_Start(date);
// Set the recurrence pattern.
pAppt->GetRecurrencePattern(&pRec);
pRec->put_RecurrenceType(olRecursWeekly);
pRec->put_DayOfWeekMask(olMonday);
pRec->put_NoEndDate(VARIANT_TRUE);
// Save the Appointment.
pAppt->Save();
// Release resources.
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 = #5/10/2007 8:30 PM#
' 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
Tasks
Creating a Recurring Appointment
Other Resources
Pocket Outlook Object Model Samples
Pocket Outlook Object Model Application Development