That event you're handling won't catch a lot of changes. It also will fail
to work after a while since the myItem object will be out of scope once
Application_Startup() finishes and the garbage collector will remove that
reference and its events. Always declare an object variable at a class level
to keep it alive and therefore keep the events alive.
You can handle the events for the Items collection of the Calendar folder.
Declare that Items collection at class level and then handle the ItemAdd,
ItemChange and ItemRemove events.
For recurring events you have to get the master appointment, after testing
IsRecurring on the item. If it is recurring then use GetRecurrencePattern to
get at RecurrencePattern.Parent to get the master appointment. Never access
the RecurrencePattern unless IsRecurring is true, it will make the
non-recurring item recurring.
Once you have the master appointment you can see if there are any changes to
individual occurrences by checking the RecurrencePattern.Exceptions
collection, which has all modified and deleted occurrences.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"kalukaley" wrote in message
...
Below is a copy of the code that I'm using to catch when someone updates
an
item in their calendar.
How would I alter this code to capture an event any appointment in the
calendar.
Also, if one of the appointments is a recurring appointment how do I
capture
the update of a single item in the series rather than an update to the
entire
series?
Public WithEvents myItem As AppointmentItem
Private Sub Application_Startup()
Set myItem =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderCalendar).Items.GetFirst
End Sub
Private Sub myItem_PropertyChange(ByVal Name As String)
MsgBox "The " & Name & " property changed."
End Sub