in reply to Re: Outlook OLE message CreationTime
in thread Outlook OLE message CreationTime
Steve
#use strict; use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Const 'Microsoft Outlook'; my $mailboxname = "Mailbox - Steve"; my $Outlook; # set up OLE eval {$Outlook = Win32::OLE->GetActiveObject('Outlook.Application')}; die "Outlook not installed" if $@; unless (defined $Outlook) { $Outlook = Win32::OLE->new('Outlook.Application', sub {$_[0]->Quit +;}) or die "Can't start Outlook"; } my $ol = Win32::OLE::Const->Load($Outlook); my $namespace = $Outlook->GetNamespace("MAPI"); my $Folder = $namespace->Folders($mailboxname)->Folders('Inbox') || di +e "Can't open folder\n"; my $n = $Folder->Items->Count; # process messages print "Processing $n messages\n\n"; for my $i (1..$n) { print "Message $i "; my $msg = $Folder->Items($i); my $time = Win32::OLE::Variant->new(VT_DATE,$msg->CreationTime); print "From: ",$msg->SenderName,"\n"; print "Date: ",$time,"\n"; print "Subj: ",$msg->Subject,"\n"; print "Topic: ",$msg->ConversationTopic,"\n"; print "\n"; } undef $Outlook;
|
|---|