Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks guys.

I sussed it in the end so in case it helps anyone else here's how to create and save documents in a Lotus Notes database using Perl. I'm sure you can get more complicated than this but this works a treat for me.

"test" is the name of the form, "plain_text", "SendTo" and "Report" are just some fields on the "test" form.

(With the other code examples of sending notes and reading databases that you have kicking around on here I guess all usual bases are covered now.)

use strict; use warnings; use diagnostics; use Win32::OLE; my $Notes = Win32::OLE->new('Notes.NotesSession')or die "$!: cannot st +art Lotus Notes Session object.\n"; my ($Version) = ($Notes->{NotesVersion} =~ /\s*(.*\S)\s*$/); print "The current user is $Notes->{UserName}.\n"; print "Running Notes \"$Version\" on \"$Notes->{Platform}\".\n"; my $Database = $Notes->GetDatabase('', 'h:\$config\notes\davidapitest. +nsf') or die "$!: could not open database.\n"; if ($Database->IsOpen) { print "database is open\n"; } else { print "database is not open\n"; } print "creating new document\n"; my $Document = $Database->CreateDocument('test') or die "$!: can't cre +ate document"; if ($Document->IsNewNote) { print "document is new not saved\n"; } else { print "document is not new\n"; } print "populating fields\n"; $Document->{'plain_text'} = 'buffy'; $Document->{'SendTo'} = 'the'; $Document->{'Report'} = 'vampire slayer'; print "saving document\n"; $Document->Save (1, 1); $Document->Close; if ($Document->IsNewNote) { print "document is new not saved\n"; } else { print "document is not new\n"; }

In reply to Re: Lotus Notes by Cycle Boy
in thread Lotus Notes by Cycle Boy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-05-24 02:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found