Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Script to Add/Delete Outlook Calendar Entries


  • Please log in to reply

#1
fong21051

fong21051

    New Member

  • Member
  • Pip
  • 4 posts
Hi,

Hope someone can help me with this one.

I got an example script from the internet that I had modified below.

I modified the script to simply add outlook calendar entries in outlook calendar for 25th/26th December 2010 as "Christmas Day" and "Boxing Day".
This script is working and I will add more dates to this script later.

But would some please kindly help modify this script so that it will search and find these 2 calendar entries from outlook calendar and delete them?

I want to apply the script at user login.
The reason I need this is just in case some of my users have corrupted roaming profile and the script will apply twice! Hence, why I need a script to remove the duplicates!

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

--------------------------------------------------------------------
Any help much appreciated.
Many thanks!
  • 0

Advertisements


#2
fong21051

fong21051

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Does anyone know how to do this? Please help!
  • 0

#3
fong21051

fong21051

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Hi, does any know how to do this? I've already spent several researching and trying to write the code myself but with no success. Would really appreciate some help. Does anyone know? I'll appreciate any help! Thanks.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP