in reply to Outlook Write to Calendar

It looks like you're already pretty clear about how to call the relevant COM/OLE APIs from Perl, so really this is more of an Outlook API question than a Perl question. Your best bet is probably to go straight to the source in the source in the MSDN Library and look under the objects/methods for Outlook. Specifically it looks like you would use the Add method on the Items collection for your folder passing in the appropriate item type (probably olAppointmentItem).

Replies are listed 'Best First'.
Re^2: Outlook Write to Calendar
by nanojack (Initiate) on Dec 19, 2005 at 21:47 UTC
    OK here is what I have, I am getting into some troubles, the script is failing at the last line. I am getting the error "Can't call method "Items" on an undefined value at Untitled11.pl line 9." Not sure what to do here,
    Thanks for all the help
    nanojack
    use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; # Connection to Outlook Calendar my $outlook = Win32::OLE->new('Outlook.Application') or die "Error!\n"; my $namespace = $outlook->GetNamespace("MAPI"); my $app = $namespace->CreateItem(olAppointmentItem); my $CalendarFolderItems = $app->Items;
    -How important does a person have to be before they are considered assassinated instead of just murdered?
      I read this code sample and interpret as following. You are trying to retrieve the collection of appointments in outlook. However what you seem to be doing is creating a single appointment in
      my $app = $namespace->CreateItem(olAppointmentItem);

      and trying to retrieve the Items collection of the Appointment. Perl is telling you that there is no Items collection attached to an Appointment Item.

      Look at your first question and try something allong the lines of:

      1. Retrieve the Namespace
      2. Get the DefaultFolder that contains Calendar objects.
      3. Retrieve collection of appointments
      4. With the collcation add an appointment.