Hi,
Hope someone can help me with this one.
I got an example script from the internet that I had modified.
The script will simply add outlook calendar entries on the dates 25th Dec 2010 as "Christmas day" and on 26th Dec 2010 as "Boxing day".
Would some please kindly help modify this script so that it will search find these 2 calendar entries from outlook calendar and delete them?
I've heard you have to use objEvents.Delete and use the MAPIFolder.Items.Find or Restrict method to locate the item(s), then delete them but I dont know how to do this. Any help is much appreciated!
---------------------------------------------------------------------------------------------------------
Const olFolderCalendar = 9
Const olAppointmentItem = 1
Const olOutOfOffice = 3
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar)
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "December 25, 2010", "Christmas Day"
objDictionary.Add "December 26, 2010", "Boxing Day"
colKeys = objDictionary.Keys
For Each strKey in colKeys
dtmHolidayDate = strKey
strHolidayName = objDictionary.Item(strKey)
Set objHoliday = objOutlook.CreateItem(olAppointmentItem)
objHoliday.Subject = strHolidayName
objHoliday.Start = dtmHolidayDate & " 9:00 AM"
objHoliday.End = dtmHolidayDate & " 10:00 AM"
objHoliday.AllDayEvent = True
objHoliday.ReminderSet = False
objHoliday.BusyStatus = olOutOfOffice
objHoliday.Save
Next
--------------------------------------------------------------------
Many thanks!
Fong
Hope someone can help me with this one.
I got an example script from the internet that I had modified.
The script will simply add outlook calendar entries on the dates 25th Dec 2010 as "Christmas day" and on 26th Dec 2010 as "Boxing day".
Would some please kindly help modify this script so that it will search find these 2 calendar entries from outlook calendar and delete them?
I've heard you have to use objEvents.Delete and use the MAPIFolder.Items.Find or Restrict method to locate the item(s), then delete them but I dont know how to do this. Any help is much appreciated!
---------------------------------------------------------------------------------------------------------
Const olFolderCalendar = 9
Const olAppointmentItem = 1
Const olOutOfOffice = 3
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar)
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "December 25, 2010", "Christmas Day"
objDictionary.Add "December 26, 2010", "Boxing Day"
colKeys = objDictionary.Keys
For Each strKey in colKeys
dtmHolidayDate = strKey
strHolidayName = objDictionary.Item(strKey)
Set objHoliday = objOutlook.CreateItem(olAppointmentItem)
objHoliday.Subject = strHolidayName
objHoliday.Start = dtmHolidayDate & " 9:00 AM"
objHoliday.End = dtmHolidayDate & " 10:00 AM"
objHoliday.AllDayEvent = True
objHoliday.ReminderSet = False
objHoliday.BusyStatus = olOutOfOffice
objHoliday.Save
Next
--------------------------------------------------------------------
Many thanks!
Fong