S
ScubaSteve7979
I'm running a vbscript to change the time of a calendar appointment,
it's fairly simple. The problem is that the reminder still comes up
the original day that I set. Example
I create an appointment for 2/10/06 at 8am with a reminder for 15
minutes. I using some other program and it realizes I need to change
the date, so my script goes in and finds that date, matches the subject
and changes the StartTime and Endtime. This works perfectly. Lets say
I updated it to 2/12/06 at 8am. I still get a reminder on 2/10 at 7:45
that says "Due in 2 days". Any ideas? Here's my code....
Sub UpdateAppointment(UserID)
Dim StartTime
Dim EndTime
Dim NewStartTime
Dim NewEndTime
Dim objAppointmentFilterField1
Dim objAppointmentFilterField2
Set CDOSession = CreateObject("MAPI.Session")
'Connect to CDO objects, MKE200 is a gateway to all mail servers
CDOSession.Logon , , , , , , "MKE200" & vbLf & UserID
'Get the Calendar folder
Set oFolder = CDOSession.GetDefaultFolder(CdoDefaultFolderCalendar)
Set oMessages = oFolder.Messages
'Create a filter in order to set a date range
Set oFilter = oMessages.Filter
'Get the OLD Due Date
'StartTime = Eworkgetfield("oldDueDate","")
StartTime = Ework.oldDueDate
EndTime = StartTime
Set objAppointmentFilterField1 = oFilter.Fields.Add (&H00600040,
EndTime)
Set objAppointmentFilterField2 = oFilter.Fields.Add (&H00610040,
StartTime)
NewStartTime = Ework.DueDate
NewEndTime = NewStartTime
Set oAppointment = oMessages.GetFirst
Do While Not oAppointment Is Nothing
'This IF checks the subject to ensure the proper appointment has been
found
If oAppointment.Subject = Ework.mDescription Then
'MsgBox("Found " & oAppointment.Subject)
oAppointment.StartTime = NewStartTime
oAppointment.EndTime = NewEndTime
oAppointment.Update
exit sub
Else
Set oAppointment = oMessages.GetNext
End If
Loop
CDOSession.Logoff
End Sub
it's fairly simple. The problem is that the reminder still comes up
the original day that I set. Example
I create an appointment for 2/10/06 at 8am with a reminder for 15
minutes. I using some other program and it realizes I need to change
the date, so my script goes in and finds that date, matches the subject
and changes the StartTime and Endtime. This works perfectly. Lets say
I updated it to 2/12/06 at 8am. I still get a reminder on 2/10 at 7:45
that says "Due in 2 days". Any ideas? Here's my code....
Sub UpdateAppointment(UserID)
Dim StartTime
Dim EndTime
Dim NewStartTime
Dim NewEndTime
Dim objAppointmentFilterField1
Dim objAppointmentFilterField2
Set CDOSession = CreateObject("MAPI.Session")
'Connect to CDO objects, MKE200 is a gateway to all mail servers
CDOSession.Logon , , , , , , "MKE200" & vbLf & UserID
'Get the Calendar folder
Set oFolder = CDOSession.GetDefaultFolder(CdoDefaultFolderCalendar)
Set oMessages = oFolder.Messages
'Create a filter in order to set a date range
Set oFilter = oMessages.Filter
'Get the OLD Due Date
'StartTime = Eworkgetfield("oldDueDate","")
StartTime = Ework.oldDueDate
EndTime = StartTime
Set objAppointmentFilterField1 = oFilter.Fields.Add (&H00600040,
EndTime)
Set objAppointmentFilterField2 = oFilter.Fields.Add (&H00610040,
StartTime)
NewStartTime = Ework.DueDate
NewEndTime = NewStartTime
Set oAppointment = oMessages.GetFirst
Do While Not oAppointment Is Nothing
'This IF checks the subject to ensure the proper appointment has been
found
If oAppointment.Subject = Ework.mDescription Then
'MsgBox("Found " & oAppointment.Subject)
oAppointment.StartTime = NewStartTime
oAppointment.EndTime = NewEndTime
oAppointment.Update
exit sub
Else
Set oAppointment = oMessages.GetNext
End If
Loop
CDOSession.Logoff
End Sub