A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Changing Appointment times with CDO



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 3rd 06, 03:57 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 1
Default Changing Appointment times with CDO

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(CdoDefaultFolderCalend ar)
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

Ads
  #2  
Old February 4th 06, 10:36 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Changing Appointment times with CDO

Am 3 Feb 2006 06:57:27 -0800 schrieb :

Did you try to set the ReminderMinutesBeforeStart property again?

Anyway I wonder how do you access e.g. the StartTime property in your code,
because that is unknown for a MAPI Message object.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
--
www.vbOffice.net --


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(CdoDefaultFolderCalend ar)
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

  #3  
Old February 6th 06, 02:51 PM posted to microsoft.public.outlook.program_vba
Steve
external usenet poster
 
Posts: 1
Default Changing Appointment times with CDO

And what would be the proper way of accessing the startime?

  #4  
Old February 8th 06, 08:16 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Changing Appointment times with CDO

Am 6 Feb 2006 05:51:18 -0800 schrieb Steve:



And what would be the proper way of accessing the startime?


Sorry, I never realized that MAPI knows an Appointment object which has
indeed a StartDate property.

Anyway, with a Message object you can access the StartDate with:
Debug.Print message.Fields("{0220060000000000C000000000000046} " & "0x820D")

The most common property tags are explained at
http://www.cdolive.com/cdo10.htm

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --
  #5  
Old April 3rd 06, 05:26 PM posted to microsoft.public.outlook.program_vba
ud
external usenet poster
 
Posts: 5
Default Changing Appointment times with CDO

Hi Michael , i am using the same code and it's work fine the problem is when
i am trying to Update Recurring appointment it's updating only the one day
and for all appointments

Could you please help me .

Thanks, Uzi

"Michael Bauer" wrote:

Am 6 Feb 2006 05:51:18 -0800 schrieb Steve:



And what would be the proper way of accessing the startime?


Sorry, I never realized that MAPI knows an Appointment object which has
indeed a StartDate property.

Anyway, with a Message object you can access the StartDate with:
Debug.Print message.Fields("{0220060000000000C000000000000046} " & "0x820D")

The most common property tags are explained at
http://www.cdolive.com/cdo10.htm

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --

  #6  
Old April 3rd 06, 05:30 PM posted to microsoft.public.outlook.program_vba
ud
external usenet poster
 
Posts: 5
Default Changing Appointment times with CDO

sorry - "...and NOT for all appointments"

Hi Michael , i am using the same code and it's work fine the problem is when
i am trying to Update Recurring appointment it's updating only the one day
and NOT for all appointments


"ud" wrote:

Hi Michael , i am using the same code and it's work fine the problem is when
i am trying to Update Recurring appointment it's updating only the one day
and for all appointments

Could you please help me .

Thanks, Uzi

"Michael Bauer" wrote:

Am 6 Feb 2006 05:51:18 -0800 schrieb Steve:



And what would be the proper way of accessing the startime?


Sorry, I never realized that MAPI knows an Appointment object which has
indeed a StartDate property.

Anyway, with a Message object you can access the StartDate with:
Debug.Print message.Fields("{0220060000000000C000000000000046} " & "0x820D")

The most common property tags are explained at
http://www.cdolive.com/cdo10.htm

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mapi cdo service [email protected] Outlook - General Queries 8 February 20th 06 03:33 PM
Finding appointment times in outlook calendar? [email protected] Outlook - Calandaring 1 February 9th 06 08:56 PM
TIME ZONE CHANGE AFFECTS APPOINTMENT CALENDAR TIMES AJS Outlook - Calandaring 4 February 5th 06 06:53 PM
Show Appointment Times! Alan Lindsay Outlook - Calandaring 0 February 2nd 06 11:26 PM
Changing follow up times for multiple contacts in OL 2003 Sue Mosher [MVP-Outlook] Outlook - Using Contacts 1 January 19th 06 11:06 PM


All times are GMT +1. The time now is 03:15 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.