Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WIN32::OLE and Lotus Notes

82 views
Skip to first unread message

TCamisa

unread,
Jan 6, 2012, 12:28:16 AM1/6/12
to
I just started playing with WIN32:OLE to automate some Lotus Notes
clean up. I started with the nice code provided by hvanbelle. This
is as far as I got:

use Win32::OLE;

my $server = 'SOMESERVER';
my $database = 'Mail\SOMEFILE.nsf';
my $folder = 'SOMEFOLDER\Reporting';


#connect to the Notes database
my $Notes = Win32::OLE->new('Notes.NotesSession') || warn "Cannot
start Lotus Notes Session object: $!\n";
my $Database = $Notes->GetDatabase($server, $database);

#Fetch contents of the folder
my $Response = $Database->GetView($folder);
my $Count = $Response->TopLevelEntryCount;
my $Index = $Count;

open (OUT, ">$file");

#loop through all emails
for (1..$Count)
{
my $Document = $Response->GetNthDocument($Index--);
my $subject = $Document->GetFirstItem('Subject')->{Text};
my $body = $Document->GetFirstItem('Body')->{Text};
my $date = $Document->GetFirstItem('Delivereddate')->{Text};
my $array_ref = $Document->{'$FILE'};
foreach my $attachment (@$array_ref)
{
if ($attachment)
{
print $attachment . "\t";
#I Think getting the attachment size is pretty important
# I tried a few things
like this:
my $objAttach =
$Document->GetAttachment($attachment);
print $objAttach->{FileSize};
print "\n";
#It Doesn't work
}
}
}

Any Suggestions for getting the file size of a attachment

joao.c...@gmail.com

unread,
Mar 20, 2012, 6:53:24 PM3/20/12
to
I have never created a Lotus Notes object, but like any object in perl... just dump it and you will eventually discover, sooner if you grep responsibly. ;)
0 new messages