WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Writing Appointments to Outlook


Question:

I am trying to write a script that will allow me to add appointments to Outlook (Office 2000). After searching the database, I found out how to get a list of appointments, but nothing on writing them. Has anyone got some sample code or an idea on how this can be done?

Answer:

Give this code a try.
olAppointmentItem=1
olByReference=4 
recuring=0

myOlApp = ObjectOpen("Outlook.Application")
myItem = myOlApp.CreateItem(olAppointmentItem)
myItem.Subject = "Test Subject"
myItem.Location = "At home"
myItem.Body = "Don't forget this will you"
myItem.BusyStatus = 3 ;0 Free , 1 Tentative, 2 Busy, 3 Out of office
;myItem.RecurrencePattern = 0 ;0 Daily
year=ItemExtract(1,TimeYmdHms ( ),":")
month=ItemExtract(2,TimeYmdHms ( ),":")
date=ItemExtract(3,TimeYmdHms ( ),":")
hour=ItemExtract(4,TimeYmdHms ( ),":")
minute=ItemExtract(5,TimeYmdHms ( ),":")+15
If minute>=60
    minute=minute-60
    hour=hour+1
EndIf
If hour>=24
    hour=hour-24
    day=day+1
EndIf
myItem.Start = StrCat(date,"/",month,"/",year," ",hour,":",minute,":00")
myItem.Duration = 90
type = olByReference
If recuring==1 Then myItem.Display
Else myItem.Save


ObjectClose(myItem)
ObjectClose(myOlApp)

Article ID:   W16590
File Created: 2005:02:18:12:21:34
Last Updated: 2005:02:18:12:21:34