Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46030

Automate Grabbing Email From Outlook On Shared Folder

Newsgroups comp.lang.python
Date 2013-05-25 20:09 -0700
Message-ID <d031b8c2-0936-4cdf-af53-eb46847351a3@googlegroups.com> (permalink)
Subject Automate Grabbing Email From Outlook On Shared Folder
From darin.hensley@gmail.com

Show all headers | View raw


I am trying to automate Outlook mail client by retrieving a message with an attachment, using win32com. The message box is a shared folder that is not really underneath root folder inbox, so I had no success with inbox = mapi.GetDefaultFolder(6). However, I did have some success with:

    import win32com.client
    outlook = win32com.client.Dispatch("Outlook.Application")
    mapi = outlook.GetNamespace("MAPI").Folders
    print mapi[7]

In which the output is "Mailbox - Foo Operations"--- the folder I want.

However, if I tried:
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application")
mapi = outlook.GetNamespace("MAPI").Folders
messages = mapi[7].Items
message = messages.getLast()
body_content = message.body
print body_content

I get no success. So I am pretty much stuck. I googled many things but no success. I prefer to win32com since I don't have to use a login in the script. But if this is possible with another Python module with no login requirement that would be great also.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Automate Grabbing Email From Outlook On Shared Folder darin.hensley@gmail.com - 2013-05-25 20:09 -0700

csiph-web