Domino 9 und frühere Versionen > Entwicklung
Aus einem Script auf Notes-DB's zugreifen
AivisLolop:
Hallo!!
Ich möchte aus einem Script heraus auf eine Lotus Notes Datenbank zugreifen. Weiß jemand ob es da Perl/DBI Module gibt??? Oder gibt es da sonst irgendwelche Möglichkeiten?
Es muss auch nicht unbedingt mit Perl gehen. C/C++ währe auch net schlecht.
Bitte helft mir.
MfG,
Aivis Lolop
eknori (retired):
Wie soll dein "Script" denn aussehen ( Visual Basic, VBA ?? ).
Bei C/C++ kanst du über die C API von Notes zugreifen.
eknori
AivisLolop:
Hallo eknori,
wie das Script aussehen soll, weiß ich noch net ( Am liebsten Perl :-) ). Da hat mein Chef noch mit Infos gegeizt *ggg*.
Wenn ich mittels C API von Notes auf eine Notes Datenbank zugreife, geschieht das dann mittels Embedded SQL oder so?
Klär mich doch bitte mal auf, wie so etwas aussehen könnte.
Danke auch!
MfG,
Aivis Lolop
Meff:
Was willst Du eigentlich genau machen ???
Meff ;)
jofa:
Hi Aivis,
also ich habe es hinbekommen mit der Perl Version von ActiveState:
Ein Beispiel:
---begin---
#!/usr/bin/perl -w
use strict;
use Win32::OLE;
my %count;
my $Buffer;
my $choice;
my $doc;
my $Document;
my %noteshash = ();
my $num;
my $userid = "mail/meinemaildb.nsf";
my $search;
my $server = "myhomeserver.myfirm.de";
my $val;
my $VERSION = '1.0';
my $Notes = Win32::OLE->new('Notes.NotesSession')or die "Cannot start Lotus Notes Session object.\n";
my $Database = $Notes->GetDatabase($server, $userid) or die "Could not open database.\n";
my $AllDocuments = $Database->GetView('($Inbox)');
#my $Count = $AllDocuments->Count;
#my @counted = (1 .. $Count);
$doc = $AllDocuments->GetFirstDocument;
print "\n\nPlease wait while the notes mail file is processed . . .\n\n";
#foreach $doc (@counted) {
while ($doc) {
$val = $doc->GetItemValue('Subject');
print @$val[0]."\n";
$doc = $AllDocuments->GetNextDocument($doc);
# $val = sprintf "$doc. %s", $Document->GetFirstItem('Subject')->{Text};
# $noteshash{$doc}=$val;
}
while ($choice ne "Q"){
print "\n\nWelcome to the Perl Notes client.\n";
print "Press I to look at an index of email.\n";
print "Press B to look at the body of a message.\n";
print "Press Q to exit the program.\n";
chomp($choice = <STDIN>);
$choice =~ tr/a-z/A-Z/;
if ($choice eq "I") {
&idex;
}
if ($choice eq "B") {
&body;
}
if ($choice eq "Q") {
exit;
}
}
sub idex {
my $docnum;
print "What is the first number you would like to see? ";
chomp($docnum = <STDIN>);
my $limit = $docnum + 5;
for ($docnum; $docnum < $limit; $docnum++) {
$Document = $AllDocuments->GetNthDocument($docnum);
$val = $Document->GetItemValue('Subject');
print "Number: $docnum Subject: @$val[0]\n";
}
}
sub body {
print "What document would you like to look at? ";
chomp($doc = <STDIN>);
$Document = $AllDocuments->GetNthDocument($doc);
# my @Attributes = $Buffer->info();
print "\n\n$doc\n".$Document->GetFirstItem('Body')->{Text};
}
---end---
Ich habe zunächst CygWin installiert, danach Perl von ActiveState, beides verlinkt ... klappt. Allerdings musst Du einige der benötigten Module nachladen, aber nicht von CPAN :-( sondern direkt mit dem Modulemanager von ActiveState: ppm3
Gruss JoFa
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln