Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Lotus Notes and datetimes

by Cycle Boy (Initiate)
on May 20, 2002 at 14:46 UTC ( [id://167843]=perlquestion: print w/replies, xml ) Need Help??

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

Hello again.

I've been through all the examples I can find on here that show Perly Notes type happenings and from them I've borrowed enough bits to get what I need to do (well almost).

The problem is to scan Notes emails and detach any attachments where the email is <, =, > a certain date.

All Notes docs have a Created (datetime) property. Does anyone know how to manipulate this via Perl?

I've tried umpteen combinations and blatant guesses but none of them work so I thought I'd ring the monastery bell and hope a fellow monk has the wisdom required...

Many thanks,
David

Replies are listed 'Best First'.
Re: Lotus Notes and datetimes
by buckaduck (Chaplain) on May 20, 2002 at 19:15 UTC
    Here's an example of extracting a date from an email message in Lotus Notes:
    use strict; use Win32::OLE; # Open the email database in Lotus Notes my $notes = Win32::OLE->new('Notes.NotesSession') or die "Can't open Lotus Notes"; my $database = $notes->GetDatabase("",""); $database->OpenMail; # Get a list of all of the documents in the Inbox # (Use single-quotes to protect the dollar-sign) my $view = $database->GetView('($Inbox)'); # Get a Notes document my $doc = $view->GetFirstDocument; # The "Created" timestamp is stored as an object # via a property named "Created" my $create_date = $doc->{Created}; # To convert this to a usable date like "09/11/2001", # call the "Date" method on this object my $date = $create_date->Date;
    I worked this out via the debugger: I created the object $doc and typed:  m $doc

    Aha! The document has a "Created" property. I saved this into $date and typed: x $date

    The debugger responded that $date is an OLE object. So I typed: m $date and I saw that it has a "Date" method. Just play around in the debugger and you'll find lots of cool stuff.

    buckaduck

      Works a treat.

      Thanks for that.

      Cheers,
      David

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found