RecurrencePattern Object (Outlook)
Represents the pattern of incidence of recurring appointments and tasks for the associated AppointmentItem and TaskItem object.
Remarks
Use the GetRecurrencePattern method to return the RecurrencePattern object associated with an AppointmentItem or TaskItem object.
Calling GetRecurrencePattern or ClearRecurrencePattern has the side effect of setting the IsRecurring property of the item accordingly. This property can be used as required for efficient filtering of the Items object.
The type of recurrence pattern is indicated by the RecurrenceType property. The RecurrenceType property is the first property you should set.
The following properties are valid for all recurrence patterns: EndTime, Occurrences, StartDate, StartTime, or Type.
The following table shows the properties that are valid for the different recurrence types. An error occurs if the item is saved and the property is null or contains an invalid value. Monthly and yearly patterns are only valid for a single day. Weekly patterns are only valid as the Or of the DayOfWeekMask.
RecurrenceType |
Properties |
Examples |
---|---|---|
olRecursDaily |
Duration , EndTime, Interval, NoEndDate, Occurrences, PatternStartDate, PatternEndDate, StartTime |
A value N for Interval is every N days. |
olRecursWeekly |
DayOfWeekMask, Duration, EndTime, Interval, NoEndDate, Occurrences, PatternStartDate, PatternEndDate, StartTime |
A value N for Interval is every N weeks. An example of DayofWeekMask is every Tuesday, Wednesday, and Thursday. |
olRecursMonthly |
DayOfMonth , Duration, EndTime, Interval, NoEndDate, Occurrences, PatternStartDate, PatternEndDate, StartTime |
A value N for Interval is every N months. A value N for DayofMonth is every Nth day of the month. |
olRecursMonthNth |
DayOfWeekMask, Duration, EndTime, Interval, Instance, NoEndDate, Occurrences, PatternStartDate, PatternEndDate, StartTime |
A value N for Interval is every N months. An example of value N for Instance is every Nth Tuesday. An example of DayofWeekMask is every Tuesday and Wednesday. |
olRecursYearly |
DayOfMonth, Duration, EndTime, Interval, MonthOfYear, NoEndDate, Occurrences, PatternStartDate, PatternEndDate, StartTime |
A value N for DayofMonth is the Nth day of the month. An example of MonthOfYear is February. |
olRecursYearNth |
DayOfWeekMask, Duration, EndTime, Interval, Instance, NoEndDate, Occurrences, PatternStartDate, PatternEndDate, StartTime |
An example of value N for Instance is the Nth Tuesday. An example of DayofWeekMask is Tuesday, Wednesday, and Thursday. An example of MonthOfYear is February. |
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 for Applications (VBA) or Visual Basic, set that existing object to Nothing. In C#, explicitly release the memory for that object. For a code example, see the topic for the AppointmentItem 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.