$App = new COM("Outlook.Application"); 
$Apt = $App->CreateItem(olAppointmentItem);
$Apt->Start = "1079336643";
$Apt->Duration = "30";
$Apt->Subject = "Piano lesson";
$Apt->Location = "The Teacher's House";
$Apt->Body = "This is the body of the appointment";
$Apt->BusyStatus(olBusy);
$Apt->ReminderMinutesBeforeStart = "120";
$Apt->ReminderSet = "True";
$Apt->Display(true);
$Apt->Save;

I'm trying to set up an appointment in Outlook, but nothing happens, (no error msgs), when I run this script.

Help?

    $App = new COM("Outlook.Application");

    $Apt = $App->CreateItem(olAppointmentItem);
    $Apt->Start = "1079336643";

    looks to me like the problem is here

    1. you instantiate a new COM object---good

    2. you say let $Apt be equal to the output of $App oject using
      CreateItem() method. --- good

    3. heres the problem I think you are now calling methods from the returned var of $App->CreateItem(), when you should be calling the methods/vars from you instantiated object $App not $Apt

    also insure internally your vars within your methods are using $this->whatevervarname.

    good luck

    AJ

      $objApp = new COM("Outlook.Application"); 
      $myItem = $objApp->CreateItem(1); 
      $myItem->Subject=" Subject of Meeting"; 
      $myItem->Body="Description of meeting (appears in body of appt)"; 
      $myItem->Location = "Where is the meeting?"; 
      $myItem->Start="03/15/2004 14:00"; // date and time in this format
      $myItem->Duration = "60"; // how long is the meeting?
      //$myItem->Display(); //  show the meeting
      $myItem->Save();  // don't show it just save it in this case...
      

      Damn this is some powerful stuff...

      The only error I had was I had the Date in the wrong format! Now i have a php script that can set appts in outlook without the user even seeing it happening. This way I don't need to sync the two programs because they can use outlook for their scheduling purposes!

      Woo Hoo

        Write a Reply...