开发者

How can I use Perl to open the Inbox through the Lotus Notes API?

I am able to open Lotus notes api using Perl, without errors, also I can get list of views that includes Inbox, but when I try to read messages from that view it appears empty? What might I be doing wrong? (in fact it seems like something might of changed on notes side as this code used to work before)

Result of code below: NAME of View is: ($Inbox) has count of: 0 etc.

CODE:

use Win32::OLE;
my $Notes = Win32::OLE->new('Notes.NotesSession')
or die "Cannot start Lotus Notes Session object.\n";
my $database = $Notes->GetDatabase("",'mail\VIMM.nsf');
$database->OpenMail;
my $ar开发者_开发问答ray_ref = $database->{Views};
foreach my $view (@$array_ref) {
    my $name = $view->{Name};
    print "NAME of View is: $name ";
    $view = $database->GetView($name);
    print "has count of: ", $view->{entryCount}, "\n";
}


Is the mailbox open to all users? You could try setting the -Default- access to Manager and grant it all available roles, just to make sure it's not a security issue preventing the documents from being seen.


I believe it is spelled "EntryCount"?

Also, I recommend "use strict" and "use warnings".


Per runrig's comment, EntryCount is an attribute, so I believe you need: $view->{entryCount}


Try checking Win32::OLE::LastError() messages. You can do this explicitly with a sub like:

sub w32_ok {
    if (my $error = Win32::OLE::LastError()) {
        print "Win32::OLE Error!  Got: $error";
    }
}

Or, have it croak errors, like:

Win32::OLE->Option( Warn => 3 ); # will now croak on errors.

It may be having problems accessing the data you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜