A
Akki
Hi,
I'm developing a .NET-application (C#) which must be able to
synchronise the outlook-agenda with the agenda of another application.
I'm using the official primary interop assembly for outlook (v11) which
works fine.
For the synchronisation to work, I must, for example, be able to change
the recurrence pattern of an appointment or programmatically add some
exceptions to the pattern. I have looked at several examples and it
doesn't seem to be very hard:
- get the main item/appointment
- get it's recurrence pattern
- get the occurrence on a specified date
- delete this occurrence, or change this occurrence's properties and
save it
To be more specific, this is some of the code I've written:
Here, exc.OriginalDate is the date of an exception-object (a deleted
one) from the other application.
The code executes fine; while debugging, ''item" gets a valid value,
item.Delete() is executed and finally the main appointment is saved.
The problem is, and I'm really stuck here, that the Exception-list of
the recurrence-pattern doesn't get filled:
_appointment.GetRecurrencePattern().Exceptions.Count stays 0! Needless
to say, nothing changes in the Outlook-view as well. Deleting or
changing occurrences via Outlook's own interface works fine.
Am I forgetting some trivial steps when saving or deleting single
occurrences of the pattern? If so, the examples I've seen msut be
flawed as wel, since I'm almost literally doing the same; the only
difference is that most examples are macros of Outlook and are written
in VBA, while I'm programming C# and using Outlook's PIA. By the way,
I'm testing/debugging on Outlook 2003.
I'm developing a .NET-application (C#) which must be able to
synchronise the outlook-agenda with the agenda of another application.
I'm using the official primary interop assembly for outlook (v11) which
works fine.
For the synchronisation to work, I must, for example, be able to change
the recurrence pattern of an appointment or programmatically add some
exceptions to the pattern. I have looked at several examples and it
doesn't seem to be very hard:
- get the main item/appointment
- get it's recurrence pattern
- get the occurrence on a specified date
- delete this occurrence, or change this occurrence's properties and
save it
To be more specific, this is some of the code I've written:
Code:
MSOutlook.AppointmentItem item =
_appointment.GetRecurrencePattern().GetOccurrence(exc.OriginalDate);
if (item != null)
item.Delete();
.....
_appointment.Save();
Here, exc.OriginalDate is the date of an exception-object (a deleted
one) from the other application.
The code executes fine; while debugging, ''item" gets a valid value,
item.Delete() is executed and finally the main appointment is saved.
The problem is, and I'm really stuck here, that the Exception-list of
the recurrence-pattern doesn't get filled:
_appointment.GetRecurrencePattern().Exceptions.Count stays 0! Needless
to say, nothing changes in the Outlook-view as well. Deleting or
changing occurrences via Outlook's own interface works fine.
Am I forgetting some trivial steps when saving or deleting single
occurrences of the pattern? If so, the examples I've seen msut be
flawed as wel, since I'm almost literally doing the same; the only
difference is that most examples are macros of Outlook and are written
in VBA, while I'm programming C# and using Outlook's PIA. By the way,
I'm testing/debugging on Outlook 2003.