Problem while reading an outlook in box using python.

V

venutaurus539

Hello,
I was getting an error in Cocreate instance while trying to
access "Outlook" using python script. The python script looks like:

from win32com.client import Dispatch
session = Dispatch("MAPI.session")
session.Logon('OUTLOOK') # MAPI profile name
inbox = session.Inbox

When I tried to execute the script I got the error:

IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)

Can any one guide me in obtaining a solution
for this.


Thanks in advance,
Venu.
 
T

Tim Golden

Hello,
I was getting an error in Cocreate instance while trying to
access "Outlook" using python script. The python script looks like:

from win32com.client import Dispatch
session = Dispatch("MAPI.session")
session.Logon('OUTLOOK') # MAPI profile name
inbox = session.Inbox

When I tried to execute the script I got the error:

IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)

Can any one guide me in obtaining a solution
for this.


Do you have Outlook installed with the CDO components?
(I think it became an option unchecked by default
at some point).

If not, then you won't have the MAPI.Session class
registered.

As a double-check, look in the registry for:

HKEY_CLASSES_ROOT\MAPI.Session

TJG
 
V

venutaurus539

May I know how to check whether my Outlook is installed with CDO
components?

There is no entry in my Registry Database with the name MAPI.Session.

Thank you,
Venu.
 
T

Tim Golden

May I know how to check whether my Outlook is installed with CDO
components?

There is no entry in my Registry Database with the name MAPI.Session.


Well, that pretty much *is* the check. Get hold of your Office
install disk and do a reinstall and look out for suboptions
of Outlook saying things like "CDO" or "Collaboration Data
Objects". Tick the box and click [Install].

TJG
 
V

venutaurus539

May I know how to check whether my Outlook is installed with CDO
components?
There is no entry in my Registry Database with the name MAPI.Session.

Well, that pretty much *is* the check. Get hold of your Office
install disk and do a reinstall and look out for suboptions
of Outlook saying things like "CDO" or "Collaboration Data
Objects". Tick the box and click [Install].

TJG


Thanks Tim, it worked.!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top