RecurrencePattern.GetOccurrence() fails on patterns from recurringTasks

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I'm getting a

"Member not found. (Exception from HRESULT: 0x80020003
(DISP_E_MEMBERNOTFOUND))"

error when I try to get a particular occurrence of a recurring task.

The MSDN documentation implies that you can get an particular
occurrence of an appointment or task using the following technique
(expressed here is pseudocode):

Item recurringItem = NameSpace.GetItemFromId(entryId,storeId);
RecurrencePattern pattern = recurringItem.GetRecurrencePattern();
Item occurrence = pattern.GetOccurrence(date);

That approach works correctly w/ recurring appointments,
however, .GetOccurrence() fails when the item is a task.

I'm sure that there is a recurring task on 'date', b/c I can see the
task in Outlook. I'm aware of the fact that GetOccurrence() will throw
an exception if there is no occurrence on that date; that's not the
issue I'm having.

Thanks in advance.

jb
 
Recurring tasks don't work the same way as appointments. There is no master
task with a RecurrencePattern that lists all the individual tasks in its
Recurrences and Exceptions collections. Instead, each task created by the
recurrence pattern is an independent item. Therefore, you should be able to
use MAPIFolder.Items.Find to search by the specific date and other
information you know about the task.
 
Actually on the low level, the recurrence info on tasks is almost exactly
the same as on appointments.
It is just OOM defines the return type of the
RecurrencePattern.GetOccurrence method (that object is shared by both
appointment and taks objects) as Outlook.AppointmentItem, which makes no
sense for tasks.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Back
Top