title: Error Connecting to Outlook via COM
body: <p>I have the following python code</p>
  
  <pre><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
  </code></pre>
  
  <p>When i run it, the script crashes with this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "start.py", line 47, in &lt;module&gt;
      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)
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>win32com.client.gencache.EnsureDispatch("Outlook.Application")
  </code></pre>
  
  <p>Not sure what to do and what the problem is</p>
  
  <p>Update: This only happens if Outlook is running, but issuing getActiveObject crashes with 'Operation unavailable'</p>