Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Script to Add/Delete Outlook Calendar Entries


Script to Add/Delete Outlook Calendar Entries

Reply
  #1 (permalink)  
Old 01-10-11, 02:58 PM
fong21051 fong21051 is offline
New Member
 
Join Date: Jan 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Script to Add/Delete Outlook Calendar Entries

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!
Reply With Quote
  #2 (permalink)  
Old 01-10-11, 04:17 PM
fong21051 fong21051 is offline
New Member
 
Join Date: Jan 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Does anyone know how to do this? Please help!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help finding a sort of calendar script... teapot Script Requests 2 11-03-10 10:29 AM
Submit button....can it send info to my email w/out the use of php???? lisa33 HTML/XHTML/XML 7 10-17-06 11:46 AM
use html to open application absvinyl HTML/XHTML/XML 5 09-18-06 02:04 PM
need Java script ( Ajax) Calendar, tree, grid curtisannev Job Offers & Assistance 1 10-30-05 08:59 PM
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 12:12 AM


All times are GMT -5. The time now is 01:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.