Shouldn't your 

Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);

Be after the use Win32::OLE qw (.....);

As well, threading probably doesn't work all that well considering the
single-threaded apartment model required for Outlook connections in
Perl.  But maybe someone can correct me if I've led you astray on this
detail.

Steven

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
LeFevre, Ken
Sent: Thursday, November 24, 2005 7:32 AM
To: [EMAIL PROTECTED]
Subject: OLE problem with Outlook


I'm writing a program that monitors an Outlook mailbox and processes
incoming e-mail in a given folder with a specified mailbox.  When I run
the module that does that actual access in the debugger, it works great.
When I run the same module as a thread, I get the following error:
 
retrying default method at /PerlApp/Win32/OLE/Lite.pm line 156.
Win32::OLE(0.1403) error 0x800401f0: "CoInitialize has not been called"
    in METHOD/PROPERTYGET "" at /PerlApp/Cardinal/OutlookReader.pm line
209
 
I'm running the program on Windows 2K Professional SP4 using perl
5.8.4.810 and Win32::OLE 0.1403 (the actual module is dated 11/5/2001
5:48 PM).
 
Its really odd that I can access the Outlook profile enough to see all
of the mailboxes attached to it and all the folders in each mailbox.  I
can even get the ID of each folder.  The error occurs when I call
GetFolderFromID.
 
My calling sequence is:

*       a service (compiled using perlsvc) that instantiates a
dispatcher thread and several worker threads 
*       a separate module (separate .pm) that represents the dispatcher
thread.  This module instantiates an OutlookReader, retrieves the
contents of e-mails and places an entry on a Thread::Queue that is
instantiated in the service and passed in to the dispatcher thread.  It
is also passed to each worker thread so they can retrieve work from it.

*       a separate module called OutlookReader.  This object (which I've
attached) calls Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE)
in its BEGIN function.  This is the module that throws the error.

In my testing, I have a test driver that instantiates the object that
represents the dispatcher thread, so the structural hierarchy is
identical.  The only difference is that no threads are involved.
 
Any help, suggestions or ideas would be greatly appreciated.
 
Ken
 
 


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to