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

Good evening Monks. I am working on some Outlook automation with OLE. Everything is going great and I can get all the info I want about the messages, except the CreationTime property returns an Win32::OLE::Variant=SCALAR(0x1e599e8) value. Anyone know how I can turn that into English?

tia...

Steve

Replies are listed 'Best First'.
Re: Outlook OLE message CreationTime
by ikegami (Patriarch) on Sep 09, 2005 at 05:37 UTC

    Its Date and Time methods might be of use, creating strings from the value. It would be interesting to know what the Value method returns.

      Yes that did it. For anyone who is interested here is tested code to open the Outlook Inbox folder and print out info from the messages. The object model reference is here under the "reference" link on the left pane.

      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;