I have been reading about adding to outlook calednar from perl. I am not able to do this. I am able to read from outlook, but cannot write to the calendar, any on know how to do this???? Here is my code to read from outlook calendar
use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; use Digest::MD5 qw(md5_hex); use DBI; # Making a connection to a database $dbfile = 'U:\\scripts\\Perl\\outlook\\calendar.db'; $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "", { RaiseError => 1, AutoCommit => 0 }); # Connection to Outlook Calendar my $outlook = Win32::OLE->new('Outlook.Application') or die "Error!\n"; my $namespace = $outlook->GetNamespace("MAPI"); my $folder = $namespace->GetDefaultFolder(olFolderCalendar); my $CalendarFolderItems = $folder->Items; print length($folder) . "\n"; for my $itemIndex (1..$CalendarFolderItems->Count) { my $CalendarItem = $CalendarFolderItems->item($itemIndex); next if not defined $CalendarItem; $start_date = $CalendarItem->{Start}->Date; $start_time = $CalendarItem->{Start}->Time; $end_date = $CalendarItem->{End}->Date; $end_time = $CalendarItem->{End}->Time; $duration = $CalendarItem->{Duration}; $subject = $CalendarItem->{Subject}; $categories = $CalendarItem->{Categories}; $body = $CalendarItem->{Body}; $reminder = $CalendarItem->{ReminderMinutesBeforeSta +rt}; # Setting up the MD5 to create a unique identifier $md5setup = $start_date . $start_time . $end_date . $e +nd_time . $subject . $body . $duration . $reminder; $md5hash = md5_hex($md5setup); if ($categories =~ m/Holiday/){ }else{ # searching and replaicing apostraphies $subject =~ s/\'/\''/g; $body =~ s/\'/\''/g; print "*****************************************\n"; print "Start Date " . $start_date . "\n"; print "Start Time " . $start_time . "\n"; print "End Date " . $end_date . "\n"; print "End Time " . $end_time . "\n"; print "Duration " . $duration . "\n"; print "Subject " . $subject . "\n"; print "Categories " . $categories . "\n"; print "Body " . $body . "\n"; print "Reminder " . $reminder . "\n"; print "Hash " . $md5hash . "\n"; # prepairing the sql statement $sql = "NULL,'$start_date','$start_time','$end_date','$end +_time','$duration','$subject','$categories','$body','$reminder','$md5 +hash'"; # $sql = $reminder . "," . $body . "," . $categories. "," +. $subject. "," . $duration . "," . $end_time . "," . $end_date . "," + . $start_time . "," . $start_date . "," . "," . $hash; print $sql . "\n"; $dbh->do("INSERT INTO calendar VALUES ($sql)"); $dbh->commit( ); } }

In reply to Outlook Write to Calendar by nanojack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.