Can't save AppointmentItem properties of recurrence appointment

  • Thread starter Thread starter Mk23
  • Start date Start date
M

Mk23

Hi

I have a problem by manipulating Appointment items properties. Our addin
manipulates the subject of appointmentItems. When i have a recurrence
appointment, and I manipulate the subject, an exception will be thrown.
(Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

The magic thing is, that i can manipulate the subject and save it one time
(the recurrence appointment ist then shown as spli/exception appointment of
an serie) , but any further manipulation failed.

I read somewhere, that not all properties of an appointment that is
recurrence can be written. So I tried to set the new subject over the
recurrence pattern, but there is no property that offers an operation like
this. I also tried to set and save the subject only at the first appointment
of the recurrence, but the result was the same.

Has someone any idea?
 
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();
 
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.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dmitry Streblechenko said:
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
 
Back
Top