Ok I need some help, I am trying to write a Outlook conduit that will take Calender information and send them to a database. I then want to be able to connect to a database to add entries to the calendar. How can I write to the calender, I can read from it but not write to it. Any information or examples would help.
FYI here is code for reading from Outlook Calendar:
-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!
FYI here is code for reading from Outlook Calendar:
Code:
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->{ReminderMinutesBeforeStart};
# Setting up the MD5 to create a unique identifier
$md5setup = $start_date . $start_time . $end_date . $end_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','$md5hash'";
# $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( );
}
}
-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!