Board index » delphi » Recurring Appointment in Outlook

Recurring Appointment in Outlook

Hi all,

just to save some work and to avoid errors:

I have to convert Outlook-Appointments (OL 2k) into a linear number of
events.

So I have to analyze the "IsRecurring" and "RecurrencePattern" and
splitt it into single events.

Has anyone some source? Thanx for any help. :-)

 

Re:Recurring Appointment in Outlook


Quote
Holger Lembke <holgers...@hlembke.de> wrote:

i forget to say:

I do:
    folder.items.IncludeRecurrences:=true;

But number before and after is the same. And if I read
IncludeRecurrences after that, it is still "false".

Confused.

Re:Recurring Appointment in Outlook


Continuing the story.

I'm more confused after reading a lot of KB-articles.

    i:=ifolder.items.count;
    folder.items.sort('[Start]',true);
    folder.items.IncludeRecurrences:=true;
    i:=integer(folder.items.IncludeRecurrences);
    i:=folder.items.count;

The two last lines are for testing only. They show that
IncludeRecurrences is still false and count hasn't changed.

Somewhere the KB states, that COUNT doesn't work any more (shall give
maxint), but in this example it doesn't.

Somewhere else I see examples with "getfirst" and "getnext", but I
can't get anything working.

Even more confused.

Re:Recurring Appointment in Outlook


<<Holger Lembke:
    folder.items.sort('[Start]',true);

Quote

Change 'True' in this line to false. IncludeRecurrences
only works if the items are sorted in ascending order - and
using True for the second parameter of Sort sets them in
descending order.

Do be careful with IncludeRecurrences - it's very easy to
get an infinite number of them if you have recurring
appointments with no end date...

--
Deborah Pate (TeamB)
http://delphi-jedi.org
Sorry, no email please.

Re:Recurring Appointment in Outlook


"Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote:

Quote
>Change 'True' in this line to false. IncludeRecurrences
>only works if the items are sorted in ascending order - and
>using True for the second parameter of Sort sets them in
>descending order.
>Do be careful with IncludeRecurrences - it's very easy to
>get an infinite number of them if you have recurring
>appointments with no end date...

Right.  Just for the records:

I changed that multiple times during my experiments, no result.

Now I changed my code to:

Var  m  : Items;

    m:=ifolder.items;
    i:=m.count;
    m.sort('[Start]',false);
    m.IncludeRecurrences:=true;

This works.

Count gives back about "maxint" items, because a yearly event
(birthdays) doesn't have an end. So I used a "restrict" to reduce the
numbers.

But count still doesn't give correct numbers, so I changed then way to
get the items:

  Var i  : integer;
      ai : AppointmentItem;
      m  : Items;
      v  : variant;

    i:=1;
    v:=m;
    ai:=IDispatch(v.getfirst) as AppointmentItem;
    repeat
      i:=i+1;
      .....
      ai:=IDispatch(v.getnext) as AppointmentItem;
    until (ai=nil);

Works well for me.

Next step will be: what happens, if i decide to delete a recurrence
from a appointment series. Or change the start/ende-time of a single
appointment in this series.

But thats my work for the 11/27/2000. You don't need to hurry. :-)

Other Threads