Partager via


IRecurrencePattern::GetOccurrence (Windows Embedded CE 6.0)

1/6/2010

The GetOccurrence method gets the specific instance of a recurring appointment, occurring on a specific date. Changes to the Appointment apply to that particular occurrence only. 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,
   IAppointment ** ppolAppt
);

Parameters

  • date
    [in] Reference to the date object that defines the local date and time of the appointment. For information on the DATE type, see IPOutlookApp::VariantTimeToSystemTime. For information on the SYSTEMTIME structure, see SYSTEMTIME.
  • ppolAppt
    [out] Reference to the IAppointment retrieved by this method.

Return Value

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.

Code Example

The following code example changes one instance of a recurring appointment.

Note

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.

void ChangeRecurrence(IAppointment * pAppt)
{
    IPOutlookApp       * polApp;
    IRecurrencePattern * pRec;
    IAppointment       * pAppt2;

    SYSTEMTIME st = {0};
    DATE date;

    // Get the IPOutlookApp object and a Recurrence Pattern object.
    pAppt->get_Application(&polApp);
    pAppt->GetRecurrencePattern(&pRec);

    // Using the Recurrence Pattern object, get a specific instance of the recurring appointment.
    st.wMonth = 5;
    st.wDay   = 10;
    st.wYear  = 2007;

    polApp->SystemTimeToVariantTime(&st, &date);

    pRec->GetOccurrence(date, &pAppt2);

    // Change the Appointment's Start Time, and generate an Appointment exception.
    st.wHour = 20.5;
    polApp->SystemTimeToVariantTime(&st, &date);
    pAppt2->put_Start(date);

    // Save the Appointment item.
    pAppt2->Save();

    // Release resources.
    polApp->Release();
    pRec->Release();
    pAppt2->Release();
}

Requirements

Header pimstore.h
Library Pimstore.lib
Windows Embedded CE Windows CE 2.0 and later

See Also

Tasks

Creating a Recurring Appointment

Reference

IRecurrencePattern
Pocket Outlook Object Model Interfaces