PDA

View Full Version : Get Outlook item's properties before change event



bboy0303
05-29-2012, 05:06 AM
Hi all,

I have a problem with the event ItemChange(ByVal Item As Object).
I need the properties of Item before the event Change occurs, but I get only the properties after change (for example Item.Subject, Item.Start, Item.End...)

Do you have any idea? Tks for your help!

JP2112
05-29-2012, 01:04 PM
You could use global variables to store the previous values, using the Open (http://msdn.microsoft.com/en-us/library/aa171315(v=office.11)) Event to record their values.

Also have you checked out the PropertyChange (http://msdn.microsoft.com/en-us/library/aa171326(v=office.11)) Event? That will tell you which property or properties changed.

bboy0303
05-30-2012, 05:51 AM
Thank you, I have succeeded to use Inspector events to get the properties of an appointment item :

Dim WithEvents myInspector As Outlook.Inspectors
Public subject As String
Public busyStatus As Integer
Public allDayEvent As Boolean
Public startTime As Date
Public endTime As Date
Public reminderSet As Boolean
Private Sub Application_startup()
Set myInspector = Application.Inspectors
End Sub
Private Sub myInspector_NewInspector(ByVal Inspector As Outlook.Inspector)
Dim objAppt As Outlook.AppointmentItem
If Inspector.CurrentItem.Class = olAppointment Then
Set objAppt = Inspector.CurrentItem
subject = objAppt.subject
busyStatus = objAppt.busyStatus
allDayEvent = objAppt.allDayEvent
startTime = objAppt.Start
endTime = objAppt.End
reminderSet = objAppt.reminderSet
End If
Set objAppt = Nothing
End Sub

But this solution have one problem : when we change the date of an appointment by drag-and-drop, we have not an inspector. How can I fix it?

JP2112
05-30-2012, 08:40 AM
I'm pretty sure that isn't possible.