win32com.client.Dispatch(“Outlook.Application”) error pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

泪湿孤枕 提交于 2019-12-03 07:34:12

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!