cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
I am successfully operating Outlook via OLE and everything so I don't need help with that. But I've been poking around the Outlook VB docs and can't seem to find the method that would cause it to open one of its own messages. I'm hoping someone here knows how.
TIA...
Steve
Update: Thanks to Trix606. Display is indeed the needed method. Below is example code to open up the 10th message in your inbox. Unfortunately it slipped my mind that Google Desktop has a local server running, so to duplicate its function like I had in mind I would have to write a socket service that would accept the link from the browser in order to open up the message. Maybe I will get around to doing that using all my "free" time....Steve
use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Const 'Microsoft Outlook'; # set up OLE my $mailboxname = "Your Mailbox Name Here"; my $Outlook; 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 $namespace = $Outlook->GetNamespace("MAPI"); # open folder and open 10th message my $Folder = $namespace->Folders($mailboxname)->Folders("Inbox") || di +e "Can't open inbox\n"; my $n = $Folder->Items->Count; print "$n items\n"; my $msg = $Folder->Items(10); my $text = $msg->{Body}; print $text; $msg->Display; undef $Outlook;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE Outlook how to show a message
by Trix606 (Monk) on Jan 25, 2007 at 18:55 UTC |