Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Lotus Notes

by Cycle Boy (Initiate)
on Apr 26, 2002 at 08:20 UTC ( [id://162219]=note: print w/replies, xml ) Need Help??


in reply to Lotus Notes

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"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-05-22 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found