KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following python code o = win32com.client.Dispatch("Outlook.Application") ns = o.GetNamespace("MAPI") profile = ns.Folders.Item("Profile Name") tasks = profile.Folders.Item("Tasks") print tasks.Items When i run it, the script crashes with this error: Traceback (most recent call last): File "start.py", line 47, in <module> o = win32com.client.Dispatch("Outlook.Application") File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) 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.IID_IDispatch) pywintypes.com_error: (-2146959355, 'Server execution failed', None, None) I also tried: win32com.client.gencache.EnsureDispatch("Outlook.Application") Not sure what to do and what the problem is Update: This only happens if Outlook is running, but issuing getActiveObject crashes with 'Operation unavailable'
Tags (comma-separated)
Save Edits
Cancel