Hello Wolfgang,

Monday, February 26, 2001, 10:28:58 AM, you wrote:

HW> Hi,

HW> I sent already a mail concerning this problem. I am writing aagain to give
HW> some
HW> precisions.
HW> I am using ActivePerl build
HW> ActivePerl-5.6.0.623-MSWin32-x86-multi-thread.msi.
HW> I have test these two packages ....

HW> Win32-OLE-0.1403
HW> Win32-OLE-0.1402

HW> using the following code .....

HW> ######################################################################

HW> use strict;

HW> use Win32::OLE;

HW> my($outlook) = Win32::OLE->GetActiveObject('Outlook.Application')
HW>                         || Win32::OLE->new('Outlook.Application', sub
{$_[0]->>Quit;});

HW> my($namespace) = $outlook->GetNamespace("MAPI");

HW> my($folder) = $namespace->GetDefaultFolder(6);
HW> my($count);
HW> foreach (in $folder->Items) {  $count++;  }

HW> ##########################################################################

The problem here is not with your OLE or your Perl install, but
rather the syntax you used. Win32 OLE is a strange beast at best,
but with a little digging you can find your way around. It appears
to me the end result you are after is the count of the items in the
inbox of Outlook. Rather than iterating though and counting each item:

    foreach (in $folder->Items) {  $count++;  }

try this instead:

    print sprintf "%s\n", $folder->{'Items'}->Count;

When in doubt, try printing the variable you are trying to access, to
find out what it contains. You may be surprised to find it looks
nothing like you expect.


Best regards,
ryddler
[EMAIL PROTECTED]
www.cu-online.com/~ryddler/conquest



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to