Share via


IRecurrencePattern::GetOccurrence

The GetOccurrence method gets the specific instance of an appointment occurring on a specific date. Changes 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.

Syntax

HRESULT GetOccurrence(
  DATE date,
  IAppointmentItem * polAppt
);

Parameters

  • date
    [in] Reference to the date object that defines the local date and time of the appointment.
  • polAppt
    [out] Reference to the appointment retrieved by the method.

Return Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    The method completed successfully.

Example

The following code example 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->GetOccurrence(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

Smartphone: Windows Mobile 2002 and later
OS Versions: Windows CE 3.0 and later
Header: pimstore.h
Library: pimstore.lib

See Also

How to: Create a Recurring Appointment

IRecurrencePattern

Pocket Outlook Object Model API Interfaces

Last updated on Friday, April 22, 2005

© 2005 Microsoft Corporation. All rights reserved.

Send feedback on this topic to the authors.