Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

The GetOccurrencemethod 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 DATEtype, see IPOutlookApp::VariantTimeToSystemTime. For information on the SYSTEMTIMEstructure, see SYSTEMTIME.

ppolAppt

[out] Reference to the IAppointmentretrieved 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.
Copy Code
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
Windows Mobile Windows Mobile Version 5.0 and later

See Also