Good day Monks. Does anybody know how to make Outlook open a message in its own UI using a call from Perl? I am basically trying to accomplish the same thing as Google Desktop's link that says "view message in Outlook."

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;

In reply to Win32::OLE Outlook how to show a message by cormanaz

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.