IRecurrencePattern::GetOccurrence

This method is not supported in Windows CE Platform Builder 3.0.

This method gets the specific instance of an appointment occurring on a specific date. Changes made to the appointment then apply only to it. If no exception to a recurring pattern exists, a change creates a new exception; otherwise it modifies an existing exception.

HRESULT GetOccurrence( DATE date, IAppointmentItem * polAppt );

Parameters

  • date
    [in] The local date and time of the appointment.
  • polAppt
    [out] Pointer to the appointment retrieved by the method.

Return Values

S_OK indicates success. If an error occurs, the appropriate HRESULT value is returned (for example, if there is no occurrence on the specified date).

Code Example [Visual Basic]

The following Visual Basic® snippet changes one instance of a recurring appointment:

Sub CreateRecurringAppointment(polAppt As PocketOutlook.AppointmentItem)
Dim polApp As PocketOutlook.Application
Dim polAppt2 As PocketOutlook.AppointmentItem
Dim polRec As PocketOutlook.RecurrencePattern
Set polRec = polAppt.GetRecurrencePattern()

polAppt.Start = #4/5/1999 10:00 AM#

' Set the recurrence
Set pRec = pAppt.GetRecurrencePattern
Set pAppt2 = pRec.GetOccurrence(#4/5/1999#)
polAppt2.Start = #4/5/1999 11:00AM#

' Save the appointment
pAppt.Save
End Sub

Code Example [C++]

The following C++ code snippet changes one instance of a recurring appointment:

void ChangeRecurrence(IAppointment *polAppt)
{
IPOutlookApp *polApp;
IRecurrencePattern *pRec;
IAppointment *pAppt2;
SYSTEMTIME st;
DATE date;

// Convert Monday, 4/5/9 at 10:00 am to a DATE
memset(&st, 0, sizeof(SYSTEMTIME));
st.wMonth = 4;
st.wDay = 5;
st.wYear = 1999;
polApp->SystemTimeToVariantTime(&st, &date);

// Get the recurrence pattern
pAppt->GetRecurrencePattern(&pRec);
pRec->GetRecurrence(date, &pAppt2);

// Change start time
st.wHour = 11;
pAppt2->get_Application(&polApp);
polApp->SystemTimeToVariantTime(&st, &date);
pAppt2->put_Start(date);

// Save the appointment
pAppt2->Save();

// Release objects
polApp->Release();
pRec->Release();
pAppt2->Release();
}

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and later pimstore.h    

See Also

IRecurrencePattern::Unknown, IRecurrencePattern Property Methods

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.