I am on windows 7 and I have windows live installed. Now when I am trying to run following code
import win32com.client
win32com.client.Dispatch("Outlook.Application")
I am getting following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in
Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,c
lsctx)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 108, in
_GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 85, in _
GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.II
D_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
I have another machine with windows xp and Outlook installed. I ran the same code and I got the same error.
One more question. How can I get the com of windows live on windows 7?
Any suggestions and comments will be appreciated.
This is an indication that Outlook is not installed. "windows live
" or "outlook.com
" would not help you.
I was having a similar error. Have you tried running makepy.py from win32com's folder to create entries for the different COMobject's you are using? Basically, win32com just treats all of applications you interact with as default COMobjects until you let it learn about the programs installed on your computer. You'll have to run makepy.py for each program you want to control with it.
After I ran it, I gained access to much more control for Outlook. It has opened other errors that I am working on correcting.
Also, if you take your comobject (comboject = win32com.client.Dispatch("Outlook.Application")) and look at comboject._prop_map_get_.keys() you'll see all the things you can use for that program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With