Vytvorenie udalosti a úlohy do MS Outlooku v IE

Pre intranety sa hodí možnosť priamo na webstránke tlačítkom/odkazom pridávať úlohy či udalosti do kalendára MS Outlook.

microsoft-windows-8
<script>

var olAppointmentItem = 1;

function appt( Subject, Location, Start, ReminderMinutesBeforeStart )
{
  this.Subject = Subject;
  this.Location  = Location;
  this.Start  = Start;
  this.ReminderMinutesBeforeStart = ReminderMinutesBeforeStart;
}

function saveAppt( obj )
{
  out = new ActiveXObject( "Outlook.Application" );
  appt = out.CreateItem( olAppointmentItem );
/* appt.MeetingStatus = olMeeting */ /* ak chcem zavolat schodzu */
/* appt.Recipients.Add ("someone@gmail.com") */ /* koho volam na schodzu */
  appt.Subject = obj.Subject;
  appt.Location  = obj.Location;
  appt.Start = obj.Start;
  appt.ReminderMinutesBeforeStart = obj.ReminderMinutesBeforeStart;
  appt.Display();
  /* appt.Save(); */
}

function vytvor()
{
newAppt = new appt("test subject", "this location", "05/26/2000 9:00 AM", "15");
saveAppt( newAppt );
}




 function createTask() {
               //create Outlook object and map to the task folder
                var outlookApp = new ActiveXObject("Outlook.Application");
                var nameSpace = outlookApp.getNameSpace("MAPI");
                var mailFolder = nameSpace.getDefaultFolder(9); //olFolderTask

               //create the task
               var task = mailFolder.Items.add('IPM.Task');
                //set task properties 
                task.Subject = 'Subject';
                task.Body = "Body of Task";          
                task.StartDate = "01/01/2012";
                task.DueDate = "06/01/2012";
                task.ReminderSet = true;
                task.Save();
      }

</script>

<div onclick="vytvor()">VYTVOR KALENDAR</div>
<div onclick="createTask()">VYTVOR ULOHU V OTLAKU</div>

Napísal rony