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

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.