473,785 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem while reading an outlook in box using python.

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.CoCre ateInstance(IDi spatch, None, clsctx,
pythoncom.IID_I Dispatch)
com_error: (-2147221005, 'Invalid class string', None, None)

Can any one guide me in obtaining a solution
for this.
Thanks in advance,
Venu.

Oct 8 '08 #1
4 2837
ve***********@g mail.com wrote:
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.CoCre ateInstance(IDi spatch, None, clsctx,
pythoncom.IID_I Dispatch)
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_RO OT\MAPI.Session

TJG
Oct 8 '08 #2
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.
Oct 8 '08 #3
ve***********@g mail.com wrote:
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 "Collaborat ion Data
Objects". Tick the box and click [Install].

TJG
Oct 8 '08 #4
On Oct 8, 2:54*pm, Tim Golden <m...@timgolden .me.ukwrote:
venutaurus...@g mail.com wrote:
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 "Collaborat ion Data
Objects". Tick the box and click [Install].

TJG

Thanks Tim, it worked.!!!
Oct 8 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2071
by: M. Laymon | last post by:
I just installed Python 2.3.3 under Windows XP professional. After I did, my wife tried to access her email using Outlook Express and got the error messages: Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Account: 'incoming.verizon.net', Server: 'outgoing.verizon.net', Protocol: SMTP, Port: 25, Secure(SSL): No, Error Number:...
40
11899
by: ian | last post by:
Hi, I'm a newbie (oh no I can here you say.... another one...) How can I get Python to send emails using the default windows email client (eg outlook express)? I thought I could just do the following import win32com.client
10
4029
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
0
2254
by: guilligan.geo | last post by:
Hello, I'm trying to create an addin for Outlook 2002 using the one provided in the demo of win32com as a starting point. I've been able to do my addin and test it if I go the "standard" way (using the python interpreter). But now, I want other poeple to use it to I want to freeze it for windows using py2exe and py2exe is giving me a headache. First, I cannot seem to be able to register my addin with the resulting executable. I've...
0
2210
by: Slawomir Nasiadka | last post by:
Hi, I'am new to this group so I would like to say "Hello" everyone and here is my problem: I'm writing a simple application (code is at the end of this message) witch would list all mails from a directory from Outlook Express. I have: - OE 6.0 - .NET Framework 1.1 - interface definition language for OE 6.0 - msoeapi.idl
1
5707
by: Benedict Verheyen | last post by:
Hi, i get an "Unable to relay for" when trying to send an email from within my network to an email address not on my domain. I don't understand why it says "relaying" as i'm sending from an internal domain user to an external user. Email server is exchange 2003 See this trace
1
2077
by: SPJ | last post by:
My previous post was not clear, hence resending this. ------------------------- Hi, I am trying to create new tickets in the ticketing system using python. When I receive new email from a particular address, I have to trigger the python script and parse the mail in required format. The main hurdle here is, how to invoke the script on arrival of new mail? I checked the outlook settings and found that it supports only microsoft VB...
11
7739
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I enumerate win32com.client.constants?). I now want to work through the Contacts in Outlook patching in...
4
5007
by: venutaurus539 | last post by:
Hi all, How can I access the body of a mail in Outlook Inbox? I tried various options like message.Body or message.Mesg etc. but didn't work. I could get the subject of the mail using message.Subject though. Any help is appreciated. Thanks in advance, Venu
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.