Outlook Developer Home
Outlook Programmer's Library
 
Outlook Technologies
Outlook Forms
Languages
Samples
Other Technologies

 

 

To publish an Outlook 2000 calendar as a web page automatically

Microsoft Outlook 2000 includes a feature for publishing any calendar folder as a web page through the user interface. This sample code uses the same component -- Webpub.exel -- in a script that you can run either from the command line with Windows Scripting Host or from a Windows scheduling program. The script includes a USER OPTIONS section to make it easy to create multiple copies of the script, each with different options to publish different calendar folders.

This code works only with Outlook 2000 because Webpub.exe is not included as a component in later versions. An alternative for other versions might be to automate one of the Word calendar printing templates.

Click here to download the script (4kb, 6 Feb 01).

The WebPub.Create method supports these parameters:

sTitle Title displayed at the top of the page
sGraphic Path to a graphic file to use for BACKGROUND' attribute
bUseGraphic True=Use 'sGraphic' param
False=Use no background graphic
dtStartDate Start of date range to publish
dtEndDate End of date range to publish
bDetails Publish appointment details
bShowInBrowser Display in default browser after publishing
sSiteName Local path to store published calendar

Notes

You need write access to the destination system folder. We were not able to get the script to run unattended when publishing to an http folder, because the Web Publishing Wizard dialog box always appeared and there appears to be no way to suppress it. (An enterprising programmer could perhaps use SendKeys to get around this.)

Use this command to schedule the script:

cscript <path>/<filename>.vbs //B

where <path> and <filename> are the path and copy of the .vbs file. The //B switch will suppress the error MsgBox popups included in the script to assist with debugging.

If Outlook is in Corporate/Workgroup mode and you want this script to run unattended, you can use Tools | Options | Mail Services to specify a profile and force Outlook to always start with that profile. Alternatively, just make sure Outlook is already running when the script runs.

The code includes a GetMAPIFolder() function to return a MAPIFolder object based on a path string to the folder. You can reuse this function in other Outlook projects.

Some people have reported that the path name is case-sensitive. In theory, Outlook shouldn't care, but if you have problems getting it to work, try changing the case of the path.

If the script doesn't work the way you want it to, that's just the way it goes, because you're using undocumented, unsupported features. In particular, we've had reports that setting bShowInBrowser to False has no effect.

More Information

   
2002-7 TurtleFlock, LLC
All right reserved.
About OutlookCode.com

Send comments to webmaster@outlookcode.com

Designed and Implemented by TerraLink USA 

FrontPage Integration
by RobsonDesignWorks

 
 
get Sue's code | forums | share your own code | registration