RecurrencePattern.GetOccurrence(DateTime) Method

Definition

Returns a specific instance of the AppointmentItem object on the specified date.

public:
 Microsoft::Office::Interop::Outlook::AppointmentItem ^ GetOccurrence(DateTime StartDate);
public Microsoft.Office.Interop.Outlook.AppointmentItem GetOccurrence (DateTime StartDate);
Public Function GetOccurrence (StartDate As DateTime) As AppointmentItem

Parameters

StartDate
DateTime

A Date value that represents local time.

Returns

An AppointmentItem object that represents the specific appointment on the specified date.

Remarks

Note: The GetOccurrence method generates an error if no appointment of that series exists on the specified date.

When you work with recurring appointment items, you should release any prior references, obtain new references to the recurring appointment item before you access or modify the item, and release these references as soon as you are finished and have saved the changes. This practice applies to the recurring AppointmentItem object, and any Exception or RecurrencePattern object. To release a reference in Visual Basic, set that existing object to Nothing. In C#, explicitly release the memory for that object.

Note that even after you release your reference and attempt to obtain a new reference, if there is still an active reference, held by another add-in or Outlook, to one of the above objects, your new reference will still point to an out-of-date copy of the object. Therefore, it is important that you release your references as soon as you are finished with the recurring appointment.

Applies to