Problem while reading an outlook in box using python.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • venutaurus539@gmail.com

    Problem while reading an outlook in box using python.

    Hello,
    I was getting an error in Cocreate instance while trying to
    access "Outlook" using python script. The python script looks like:

    from win32com.client import Dispatch
    session = Dispatch("MAPI. session")
    session.Logon(' OUTLOOK') # MAPI profile name
    inbox = session.Inbox

    When I tried to execute the script I got the error:

    IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx,
    pythoncom.IID_I Dispatch)
    com_error: (-2147221005, 'Invalid class string', None, None)

    Can any one guide me in obtaining a solution
    for this.


    Thanks in advance,
    Venu.

  • Tim Golden

    #2
    Re: Problem while reading an outlook in box using python.

    venutaurus539@g mail.com wrote:
    Hello,
    I was getting an error in Cocreate instance while trying to
    access "Outlook" using python script. The python script looks like:
    >
    from win32com.client import Dispatch
    session = Dispatch("MAPI. session")
    session.Logon(' OUTLOOK') # MAPI profile name
    inbox = session.Inbox
    >
    When I tried to execute the script I got the error:
    >
    IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx,
    pythoncom.IID_I Dispatch)
    com_error: (-2147221005, 'Invalid class string', None, None)
    >
    Can any one guide me in obtaining a solution
    for this.

    Do you have Outlook installed with the CDO components?
    (I think it became an option unchecked by default
    at some point).

    If not, then you won't have the MAPI.Session class
    registered.

    As a double-check, look in the registry for:

    HKEY_CLASSES_RO OT\MAPI.Session

    TJG

    Comment

    • venutaurus539@gmail.com

      #3
      Re: Problem while reading an outlook in box using python.

      May I know how to check whether my Outlook is installed with CDO
      components?

      There is no entry in my Registry Database with the name MAPI.Session.

      Thank you,
      Venu.

      Comment

      • Tim Golden

        #4
        Re: Problem while reading an outlook in box using python.

        venutaurus539@g mail.com wrote:
        May I know how to check whether my Outlook is installed with CDO
        components?
        >
        There is no entry in my Registry Database with the name MAPI.Session.

        Well, that pretty much *is* the check. Get hold of your Office
        install disk and do a reinstall and look out for suboptions
        of Outlook saying things like "CDO" or "Collaborat ion Data
        Objects". Tick the box and click [Install].

        TJG

        Comment

        • venutaurus539@gmail.com

          #5
          Re: Problem while reading an outlook in box using python.

          On Oct 8, 2:54 pm, Tim Golden <m...@timgolden .me.ukwrote:
          venutaurus...@g mail.com wrote:
          May I know how to check whether my Outlook is installed with CDO
          components?
          >
          There is no entry in my Registry Database with the name MAPI.Session.
          >
          Well, that pretty much *is* the check. Get hold of your Office
          install disk and do a reinstall and look out for suboptions
          of Outlook saying things like "CDO" or "Collaborat ion Data
          Objects". Tick the box and click [Install].
          >
          TJG

          Thanks Tim, it worked.!!!

          Comment

          Working...