Share via


IRecurrencePattern::GetOccurrence

Send Feedback

The GetOccurrence method gets the specific instance of a recurring appointment, occurring on a specific date. Changes to the appointment then apply only to that occurance. 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.
  • ppolAppt
    [out] Reference to the Appointment retrieved by this 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.

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 = 4;
    st.wDay   = 5;
    st.wYear  = 1999;
    polApp->SystemTimeToVariantTime(&st, &date);
    pRec->GetOccurrence(date, &pAppt2);

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

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

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

Requirements

Pocket PC: Pocket PC 2000 and later
Smartphone: Smartphone 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

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.