Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Search Outlook E-mail by Subject and Sent (or Received) Time by today's date

by bpaen (Novice)
on Jan 20, 2003 at 05:31 UTC ( #228288=perlquestion: print w/replies, xml ) Need Help??

bpaen has asked for the wisdom of the Perl Monks concerning the following question:

I have no problem to locate E-mails based on the Subject and Sender Name etc. However, I have a trouble to interpret the "ReceivedTime" field which is a part of search criteria. I would really appreciate if someone can help me on this.

Here is the code I used (thanks for the examples provided in this section!)
foreach my $item (in $Inbox->{Items}) print "=========================================================== \n" +; print "subject : ", $item->{Subject}, "\n", print "Sent by : ", $item->{SenderName}, "\n"; print "Received at: ", $item->{ReceivedTime}, " \n";

The result for "ReceivedTime" is:

Received at: Win32::OLE::Variant=SCALAR(0x1cb00cc)

20030120 : Edit by Corion: Added formatting

Replies are listed 'Best First'.
Re: Search Outlook E-mail by Subject and Sent (or Received) Time by today's date
by zakb (Pilgrim) on Jan 20, 2003 at 09:25 UTC

    Dates are usually returned via OLE as a Variant data type.

    You most likely need to do something like:

    use Win32::OLE::Variant; my $ole_date = $item->{ReceivedTime}; print $ole_date->Date('dd/MM/yyyy'), ' ', $ole_date->Time('HH:mm:ss'), "\n";

    Untested, but lifted from a piece of code which uses the SourceSafe OLE interface, so should work!

    Try Win32::OLE::Variant for more info.
      Thak you very much. It worked for me and I should read some documentation on Win32::OLE. (I just learned Perl on the fly less than a year ago.) Thanks again.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://228288]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-09-25 11:06 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (116 votes). Check out past polls.