Script: Outlook - Add Appointment to Outlook Calendar

Posted by on Sunday, January 18, 2004 (PST)

Script: Adds appointment to an Outlook calendar. Submitted by Brian White.


 * Script:   appt.js
 * Purpose:  Add Appointment to Outlook Calendar
 * Author:   Brian White
 * Email:
 * Date:     April 25, 2000
 * Comments: This is a very basic example of creating
 *           an appointment item in Outlook. 
 * Notes:    To date, little testing has been done
 *           with other versions of Outlook and multiple
 *           profiles.
 *           Special thanks to Daren Thiel @
/* Define Outlook constant for Appointment Item */
var olAppointmentItem = 1;
/* To add other Properties, refer to the Outlook Object Model */
function appt( Subject, Location, Start, ReminderMinutesBeforeStart )
  this.Subject = Subject;
  this.Location  = Location;
  this.Start  = Start;
  this.ReminderMinutesBeforeStart = ReminderMinutesBeforeStart;
function saveAppt( obj )
  /* Create the Outlook Object and Appointment Item */
  out = new ActiveXObject( "Outlook.Application" );
  /* Create an Appointment Item */
  appt = out.CreateItem( olAppointmentItem );
  /* Transfer the data */
  appt.Subject = obj.Subject;
  appt.Location  = obj.Location;
  appt.Start = obj.Start;
  appt.ReminderMinutesBeforeStart = obj.ReminderMinutesBeforeStart;
  /* Display the data */
  /* If you want to save instead of viewing it change to appt.Save();*/
/* Set our values to be inserted into the Appointment */
newAppt = new appt("test subject", "this location", "05/26/2000 9:00 AM", "15");
/* Call our own function to save data */
saveAppt( newAppt );
/* Tell User to review the information */
WScript.Echo("Please Review the following Appointment Information");


Works only from local drives
By missaev on Monday, May 03, 2004 (PST)

The sample script worked perfectly for me, but, unfortunately, only when I ran the script from one of my local drives. As soon as I place the same HTML on the network, or on our web server, it doesn't work (no error messages displayed).


Does anyone have any idea on how to solve this?


Thank you,


Outlook Installed
By Daren on Tuesday, August 31, 2004 (PST)


Outlook needs to be installed and configured on the machine. 

You might need to have a user logged in, I would have to test to make sure. 

Basically, what you are doing is launching Outlook and loading the default profile.  Creating an Appointment and saving it.  If Outlook is not present or unconfigured it will not work.

Hope it helps,


Zone restriction
By bjoern on Tuesday, October 19, 2004 (PST)

Hi Michael,


check settings for ActiveX in your zone settings.


Normally these ActiveX controls should not work in Browser-context when accessed via Intranet / Internet (they are not marked as safe).






WSH and ADSI Administrative Scripting

New Articles
  • List installed COM objects and associated ProgIDs
    Script: Lists all COM Objects and their associated ProgIDs (If available). Win32_ClassicCOMClassSetting

  • Script: File Rotator
    Script: Rotate files where the most current file has the lowest number in the archive. When files exceed the retention period, they are deleted. Typically used for log files, backups, etc..

  • Script: Create IIS Website and DNS record
    Script: Dan Casier sent me this script that will create a website and appropriate DNS record. The script is intended for Windows 2000 Server with local DNS and necessary DNS mof installed.

  • Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon