Description

Hi Guys

Unfortunately, I couldn’t get any other Spicework scripts to function correctly, so I created my own basic script which works fine for my use case.

You’ll just need to edit the date every year, and maybe change the body to suit your own needs.

The script will only add the new calendar item if it doesn’t exist already, this means you can run the script multiple times (such as a login script) without causing duplicate calendar entries.

Source Code

Const olAppointmentItem = 1
Const olFolderCalendar = 9

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

Set colFilteredItems = objApptItems.Restrict("[Start] >= '7/25/2013' AND [Start] <= '7/27/2013' AND [Subject] = 'System Administrator Appreciation Day'")

For Each objItem In colFilteredItems
	blnExists = True
Next

If Not blnExists Then
  Set objAppointment = objOutlook.CreateItem(olAppointmentItem)
  objAppointment.Start = "7/26/2013"
  objAppointment.Subject = "System Administrator Appreciation Day"
  objAppointment.Body = "Your network is secure, your computer is up and running, and your printer is jam-free. Why? Because you’ve got an awesome sysadmin (or maybe a whole IT department) keeping your business up and running. So say IT loud; say IT proud …" & vbcrlf & vbcrlf & "Happy SysAdmin Day!" & vbcrlf & vbcrlf & "Wait… what exactly is SysAdmin Day? Oh, it’s only the single greatest 24 hours on the planet… and pretty much the most important holiday of the year. It’s also the perfect opportunity to pay tribute to the heroic men and women who, come rain or shine, prevent disasters, keep IT secure and put out tech fires left and right." & vbcrlf & vbcrlf & "See it's legit, it's even got a website and all :) http://www.sysadminday.com/" & vbcrlf & vbcrlf & "Now watch this video: http://youtu.be/OpGN3oT1thA?t=28s" & vbcrlf & vbcrlf & "Regards" & vbcrlf & "your System Admin"
  objAppointment.AllDayEvent = True
  objAppointment.ReminderMinutesBeforeStart = 15
  objAppointment.ReminderSet = True
  objAppointment.Save
End If
1 Spice up

thank you daniel3896 for the script appreciate the time and effort you took to help the community