"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Why do you make a distinction whether an appointment is recurring or not?
> You should be able to set the Start and Duration properies on the
> AppoointmentItem object.
Actually, you can't, OOM throws an illegal use of property/parameter (or
some such) if you attempt to assign Start, End, Duration and/or AllDayEvent
(all of which are inter-related, if you assign one, OOM floats the others to
fit.) *after* creating a recurrence pattern on the appointment.
When you alter a property of an occurrence [of a recurrent appointment] you
indirectly create an exception [to the recurrence pattern] but you cannot
create an exception from another exception, nor can you edit an exxception,
all you can do is remove it and then create another exception.
Occurrences and exceptions both occur in Items collections sometimes, they
look strikingly similar, but are quite different. Exceptions are children
of a recurrent event; occurrences are too, sort-of, the lines become a
little gray.
You can assign Start, End, et al *before* you create the recurrence pattern;
you can also remove the recurrence pattern, assign those fields and then
create recurrence again, but there's very little to gain from that, once the
recurrence pattern is created those properties aren't any more readable than
they are writable.
(Dmitry, I guess a career path of an industry-leading MAPIX expert tends to
swerve around OOM, but that route may have ended-up cheating you out of much
of the torture and mayhem that is OOM? Or maybe it's you that have cheated
OOM out of its many constraints?) :-)
-Mark
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Mk23" <(E-Mail Removed)> wrote in message
> news:A06CC6D5-6A9A-4951-9DAF-(E-Mail Removed)...
>> The code snippet:
>>
>> // Prüfen, ob es sich um eine Terminserie handelt
>> bool isSerie = appointment.IsRecurring;
>>
>> if (isSerie)
>> {
>> // Start and End DateTime
>> Outlook.RecurrencePattern pattern =
>> appointment.GetRecurrencePattern();
>> pattern.StartTime = startDateTime;
>> pattern.EndTime = startDateTime + duration;
>> Marshal.ReleaseComObject(pattern);
>> pattern = null;
>> }
>> else
>> {
>> // Start and End DateTime
>> appointment.Start = startDateTime;
>> appointment.End = startDateTime + duration;
>> }
>>
>> appointment.Subject = newSubject;
>> // Private Flag setzen falls Absenzcode entsprechend Konfiguriert ist
>> if ((privateAppointment == true) && (isSerie == false))
>> {
>> appointment.Sensitivity = Outlook.OlSensitivity.olPrivate;
>> }
>> appointment.Save();
>>
>
>