Outlook won't create the exception-objects on a recurring appointment

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:

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.
 
A

Akki

I think I'm closing to the error now. I found out that when I try to
save an occurrence, the Recipients-property of the AppointmentItem
shows 'The Recipients property threw an Exception of type
System.COMException (Code -763346939). The exception message is in
Dutch ('Fout bij uitvoeren van bewerking') which is a very general
message meaning something like 'An error occurred while trying to
execute procedure'.

The cause of this must be the reason why the items are not saved (or
deleted) and thus not added to the exceptions-collection of the main
appointment. I'm not sure what this exception is or why it is thrown
though....

I will be searching for the solution myself, but any help would very
much be appreciated.
 
A

Akki

Hmm, seems that this error is yet NOT the cause of my problem. It just
showed the error because Recipients is a protected/secured property
which cannot be accessed outside of Outlook. Back to square one....
I think I'm closing to the error now. I found out that when I try to
save an occurrence, the Recipients-property of the AppointmentItem
shows 'The Recipients property threw an Exception of type
System.COMException (Code -763346939). The exception message is in
Dutch ('Fout bij uitvoeren van bewerking') which is a very general
message meaning something like 'An error occurred while trying to
execute procedure'.

The cause of this must be the reason why the items are not saved (or
deleted) and thus not added to the exceptions-collection of the main
appointment. I'm not sure what this exception is or why it is thrown
though....

I will be searching for the solution myself, but any help would very
much be appreciated.
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:

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.
 
Joined
Nov 3, 2009
Messages
2
Reaction score
0
I got same problem.

Hi,

Do you have any solution there? I got same problem now.

Thanks
 

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