/build/static/layout/Breadcrumb_cap_w.png

Deploy outlook holidays

I want to deploy the holidays(outlook.hol) automaticlly for the users so their calendar is updates automaticlly.
I have edited the file outlook.hold to include adinitonal holiday for the company but is it possible to deploy theese changes so the calendar is updated automaticlly(without any user inference)

If anyoneof you know how to do it let me know.

0 Comments   [ + ] Show comments

Answers (8)

Posted by: aogilmor 15 years ago
9th Degree Black Belt
2
Try this vbscript and see if it works for you. We used it on our office 2003 systems, not sure how it would work on other systems. If it works for you, rate this post! I'm falling way behind VBscab in points and posts.....JK, but it is cool to get feedback! -OG

Const olFolderCalendar = 9
Const olAppointmentItem = 1
Const olOutOfOffice = 3
CRLF = chr(13)&chr(10)
Wscript.echo "Importing 2008 Company Holidays."+ CRLF + CRLF + "Press OK to Continue."
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar)
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "January 1, 2008", "Company Holiday - New Year's Day"
objDictionary.Add "January 21, 2008", "Company Holiday - Martin Luther King, Jr. Day"
objDictionary.Add "February 18, 2008", "Company Holiday - Presidents' Day"
objDictionary.Add "May 26, 2008", "Company Holiday - Memorial Day"
objDictionary.Add "July 4, 2008", "Company Holiday - Independence Day"
objDictionary.Add "September 1, 2008", "Company Holiday - Labor Day"
objDictionary.Add "November 11, 2008", "Company Holiday - Veterans' Day"
objDictionary.Add "November 27, 2008", "Company Holiday - Thanksgiving Day"
objDictionary.Add "November 28, 2008", "Company Holiday - Friday After Thanksgiving"
objDictionary.Add "December 25, 2008", "Company Holiday - Christmas 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
objOutlook.Application.Quit
Set objOutlook = Nothing
Wscript.echo "Completed Importing 2008 Company Holidays."+ CRLF + CRLF + "Press OK to End."
Wscript.quit
Posted by: anonymous_9363 15 years ago
Red Belt
0
I think you *may* be able to do that programmatically, using the Outlook object model.

If it were me, I'd record the steps in an Outlook macro then convert that to VB Script, ready to plumb in to a Custom Action.
Posted by: Bankeralle 15 years ago
Second Degree Blue Belt
0
ORIGINAL: VBScab

I think you *may* be able to do that programmatically, using the Outlook object model.

If it were me, I'd record the steps in an Outlook macro then convert that to VB Script, ready to plumb in to a Custom Action.



VBScab can you be a more bit specific, how do i record the steps in an Outlook macro.
Posted by: anonymous_9363 15 years ago
Red Belt
0
I don't think there would be much to gain from repeating information which is available in the MS Office Help system.

Once you've recorded your macro, copy it to your favourite text editor and remove all the data typing. That is, where you see:

. Dim objOL As Outlook.Application

replace it with:

. Dim objOL

Everything else *should* be fine. Your package should probably test that MS Outlook is installed before proceeding. Although most machines have it, of course, the packager/programmer secret is: Never assume ANYTHING!
Posted by: dunnpy 15 years ago
Red Belt
0
Bankeralle,

The other option may be to package the outlook.hol file to replace the existing file on the machine.

I believe that Outlook would need to be closed to perform the file replace.

Thanks,

Dunnpy
Posted by: anonymous_9363 15 years ago
Red Belt
0
Nice goin', Owen.

You've spurred me on to script this myself, but using the .HOL file itself. In preparation, I looked at the file. It's in a quasi-INI file format. WHAT WAS WRONG WITH USING A PROPER .INI?!? There are SO many ways to encode the data they have whilst retaining an INI format. Jeez, they could even have used - shock, horror! - CSV. It beggars belief, it really does.

BTW, I rated the post, just to give you a warm glow... :)
Posted by: aogilmor 15 years ago
9th Degree Black Belt
0
ORIGINAL: VBScab


BTW, I rated the post, just to give you a warm glow... :)


Thanks, I felt that all across the Atlantic!

:-)
Posted by: captain_planet 15 years ago
Black Belt
0
When upgrading Office 2003 with Service Pack 3, I encountered errors reading the updated OUTLOOK.HOL file using the VBScript FileSystem Object (I was trying to automate the holiday updates for end-user calendars). Instead of reading it line by line correctly, it simply output 'ÿþ[' and then lots of blank lines. At first I wondered if the new OUTLOOK.HOL was encrypted or similar, but it wasn't. So, I carried on investigating and discovered that the new OUTLOOK.HOL provided by SP3 was encoded as Unicode, as opposed to the original OUTLOOK.HOL which was encoded as ANSI. Hence to fix this issue, the OUTLOOK.HOL file needs to be forced to open as a Unicode file (by default, the OpenTextFile method opens a text file in ASCII format if no parameter is specified) by specifying the correct parameter to the OpenTextFile method (see below).

So....here is my attempt at a script which reads the OUTLOOK.HOL file and populates the calendar:


'script to add outlook holidays with no user intervention
Option Explicit
On Error Resume Next

Dim olkApp, olkCalendar, olkEvent, objFSO, objFile, arrItem, templine, tempcountry, tempcountryArray
Const ForReading = 1
Const OpenAsUnicode = -1
'Path to *.hol file
Const strFilename = "C:\Program Files\Microsoft Office\OFFICE11\1033\OUTLOOK.HOL"
'Define your country here
Const myCountry = "United Kingdom"


Set objFSO = CreateObject("Scripting.FileSystemObject")
'***IMPORTANT - Need to open in ASCII format otherwise hol file won't read correctly after applying SP3
Set objFile = objFSO.OpenTextFile(strFilename, ForReading, False, OpenAsUnicode)
Set olkApp = CreateObject("Outlook.Application")
'Obtain the default Calendar folder for the user who is currently logged on
Set olkCalendar = olkApp.GetNamespace("MAPI").GetDefaultFolder(9)


Do Until objFile.AtEndOfStream
'Read a line from *.hol file
templine = objFile.ReadLine

'Get the section name (sections are for each country)
If Left(templine,1) = "[" Then
tempcountryArray = Split(Right(templine,Len(templine)-1),"]")
tempcountry = tempcountryArray(0)
End If

'If the current section is for our chosen country, proceed to updating holidays
If LCase(tempcountry) = LCase(myCountry) Then
If instr(templine,",") > 0 Then
arrItem = Split(templine, ",")
Set olkEvent = olkApp.CreateItem(1)
olkEvent.Subject = arrItem(0)
olkEvent.Start = arrItem(1)
olkEvent.AllDayEvent = True
olkEvent.ReminderSet = False
olkEvent.Save
End If
End If

Loop

If Err.Number <> 0 Then
MsgBox "A problem was encountered whilst updating your national holidays for MS Outlook 2003." & vbcrlf & "You may not currently be connected to your Microsoft Exchange Server." & VbCrLf & "To update your holidays manually at a later date:" & VbCrLf & VbCrLf &_
"Open MS Outlook 2003" & VbCrLf &_
"Click 'Tools' > 'Options'" & VbCrLf &_
"Under the 'Preferences' tab, click 'Calendar Options...'" & VbCrLf &_
"Click 'Add Holidays...'" & VbCrLf &_
"Ensure the correct country is selected, click 'OK'" & VbCrLf &_
"Click 'Yes'", 0, "Please update your holidays manually"
End If


objFile.Close

Set olkEvent = Nothing
Set olkCalendar = Nothing
Set olkApp = Nothing
Set objFile = Nothing
Set objFSO = Nothing
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ