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


Groups > comp.lang.python > #46030 > unrolled thread

Automate Grabbing Email From Outlook On Shared Folder

Started bydarin.hensley@gmail.com
First post2013-05-25 20:09 -0700
Last post2013-05-25 20:09 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#46030 — Automate Grabbing Email From Outlook On Shared Folder

Fromdarin.hensley@gmail.com
Date2013-05-25 20:09 -0700
SubjectAutomate Grabbing Email From Outlook On Shared Folder
Message-ID<d031b8c2-0936-4cdf-af53-eb46847351a3@googlegroups.com>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web