Redemption - Recurring Activities

G

Guest

Can Redemption provide functionality similar to OOM IncludeRecurrences when
retrieving mapi tables ? If not, what is the most efficient way to use
Redemption with OOM to retrieve recurring activities?

Thanks, Tad
 
D

Dmitry Streblechenko

Recurrences are not messages. What Outlook displays in its UI is the
expanded recurrence pattern. It first figures out which messages fall within
the given time range using the ClipStart/ClipEnd named properties on the
message (they give the range of dates any given appointment covers). Then it
opens each and every one of them expanding the recurrence blob to see if any
instances fall in the range.

You can do the first part using MAPI tables by creating an AND restriction
with two sub-restrictions - see
http://www.dimastr.com/redemption/mapitable.htm#resand. Instead of using
PR_MESSAGE_DELIVERY_TIME, you will need to use two named props (called
internally ClipStart and ClipEnd):

{00062002-0000-0000-C000-000000000046}, PT_SYSTIME, ids 0x8235 and 0x8236 -
look at an appointment with OutlookSpy (click Imessage).

Once you get the restricted collection, you would need to check explicitly
in your code whether they occur in the given range.

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

Guest

Dmitry,

Thanks for pointing to the two tags the identify the start and end of a
recurrence pattern. However, what about activity messages with a ClipStart
before the start of the date range with recurrences within the date range.
Shouldn't the restriction be any message with a ClipEnd >= the start of the
date range.

Also, when you say...

"Once you get the restricted collection, you would need to check explicitly
in your code whether they occur in the given range."

....do I have to expand the recurrence BLOB to get the dates that fit the
pattern? I've seen some code by Dan Mitchell from a few years ago. Should I
be adapting that or is there an easier way?

Tad
 
D

Dmitry Streblechenko

Tad,
yes, the restricion must be (ClipStart <= RangeEnd) AND (ClipEnd >=
RangeStart).
As for expanding the recurrences, you can either do it the hard way (blob)
or use OOM to open each item using Namespace.GetItemfromID. Or wait for
version 4.3 of Redemption that will add the RDOAppointmentItem object with
the full support for recurrences. Next version of Redemption (4.2, to be
released within a month) with add support for the RDOTaskItem object (+
recurrences). RDOAppointmentItem will be added to the version after that.

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

Guest

Dmitry,

Thanks for that. I will look forward to the next two versions of Redemption
and thank you again for all your assistance in this forum. In the meantime,
if I use Namespace.GetItemfromID that will return the item but how will I get
the recurrences?

T
 
D

Dan Mitchell

=?Utf-8?B?VGFkd2ljaw==?= said:
"Once you get the restricted collection, you would need to check
explicitly in your code whether they occur in the given range."

...do I have to expand the recurrence BLOB to get the dates that fit
the pattern? I've seen some code by Dan Mitchell from a few years
ago. Should I be adapting that or is there an easier way?

There's two problems here. Say you have an appointment that is "every
tuesday for four weeks, starting on the 1st august 2006".

Firstly, you have to decode the blob of data that encodes "every
tuesday". It sounds like Dmitry's adding that to Redemption, or in the
meantime the best info is here:

http://www.geocities.com/cainrandom/dev/MAPIRecurrence.html

Secondly, once your code knows that the recurrence is every tuesday,
you need to write some date manipulation code to say "is this day a
tuesday, and is it in the period of time covered by the recurrence".
That's pretty easy -- it took me an afternoon to write code cover all of
the possibilities, the only awkward ones are things like "third tuesday
of the month" where you have to do more counting-of-days, or "seventh
work-week day", etc.

-- dan
 
D

Dmitry Streblechenko

GetItemfromID will give you the master appointment as
Outlook.AppointmentItem. You can then use the RecurrencePattern object
returned by AppointmentItem.GetRecurrencePattern method.

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

Guest

Thanks for the info, Dmitry

Dmitry Streblechenko said:
GetItemfromID will give you the master appointment as
Outlook.AppointmentItem. You can then use the RecurrencePattern object
returned by AppointmentItem.GetRecurrencePattern method.

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

Guest

Thanks for the info Dan

Dan Mitchell said:
There's two problems here. Say you have an appointment that is "every
tuesday for four weeks, starting on the 1st august 2006".

Firstly, you have to decode the blob of data that encodes "every
tuesday". It sounds like Dmitry's adding that to Redemption, or in the
meantime the best info is here:

http://www.geocities.com/cainrandom/dev/MAPIRecurrence.html

Secondly, once your code knows that the recurrence is every tuesday,
you need to write some date manipulation code to say "is this day a
tuesday, and is it in the period of time covered by the recurrence".
That's pretty easy -- it took me an afternoon to write code cover all of
the possibilities, the only awkward ones are things like "third tuesday
of the month" where you have to do more counting-of-days, or "seventh
work-week day", etc.

-- dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top