Re: Script to Delete Calendar Entry



Thanks for the reply. Where would I place it in the code and what would I
take out? I am sorry, I don't know anything about vb scripting.

To answer your question, the original script is going to be deployed through
active directory so that I could put reminders for timesheets and expense
reports on everyones calendar. I need the code to delete it just in case HR
changes a date on me! Thanks for your help.

Phil

"Sue Mosher [MVP-Outlook]" wrote:

objEvents.Delete

Why would you want to delete the appointment your code just created?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Phil" <Phil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:7A46E0CC-64DA-4AFD-B10A-1C1AA25BBF48@xxxxxxxxxxxxxxxx
I have this sample script that I modifed from here:
http://www.microsoft.com/technet/scriptcenter/resources/officetips/sept05/tips0929.mspx

The modifed script is below. It works fine, but what I need to know is how
to change the code to delete the items it created. Thanks!

Const olFolderCalendar = 9
Const olAppointmentItem = 1

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar)

Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "January 18, 2007", "Time Sheets Due"
objDictionary.Add "January 31, 2007", "Time Sheets Due"

colKeys = objDictionary.Keys

For Each strKey in colKeys
dtmEventsDate = strKey
strEventsName = objDictionary.Item(strKey)

Set objEvents = objOutlook.CreateItem(olAppointmentItem)
objEvents.Subject = strEventsName
objEvents.Start = dtmEventsDate & " 9:00 AM"
objEvents.End = dtmEventsDate & " 9:00 AM"
objEvents.AllDayEvent = False
objEvents.ReminderSet = True
objEvents.ReminderMinutesBeforeStart = 300
objEvents.BusyStatus = Free
objEvents.Save
Next

.