Menu

#741 Problem connecting to Outlook

v1.0 (example)
closed-invalid
nobody
None
3
2017-01-04
2017-01-04
Chris Luc
No

Hello - First of all, apologize if I have created this ticket in the wrong place. I tried to look around to find the right place for this issue, and this place seems best fit. Let me know otherwise, and I will move it to the right place.

I am having an issue using this Python for Windows Extensions. I use this to connect to Microsoft Outlook to pull some email messages. Below is the partial code:

import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application")
mapi = outlook.GetNamespace("MAPI")
folders = mapi.GetDefaultFolder(6).Folders
print folders

I would get the following when I execute the script:
<COMObject <unknown="">>

Now, on a different computer, I don't have this issue. I believed I have done the correct installation of Python and this extension. Please help. Thanks!

Discussion

  • Mark Hammond

    Mark Hammond - 2017-01-04
    • status: open --> closed-invalid
     
  • Mark Hammond

    Mark Hammond - 2017-01-04

    This tracker isn't for general support - you might like to resend your question to the python-win32 mailing list. You need to be subscribed to the list before you can post to it - see http://mail.python.org/mailman/listinfo/python-win32 for subscription options.

    However, it looks like your problem might be that "makepy" hasn't been run on Outlook - the simplest way to do that is to use win32com.client.EnsureDispatch instead of win32com.client.Dispatch.

     
  • Chris Luc

    Chris Luc - 2017-01-04

    This fixes the issue. Thank you so much.