python and outlook

Tim Golden tim.golden at viacom-outdoor.co.uk
Fri Oct 21 10:46:36 CEST 2005


[dt]

> Are there any links or sites on how to read outlook mail boxes or
address book?

Easiest thing to probably to automate the Outlook COM object or a MAPI
Session
for CDO access. You can do this easily with the pywin32 extensions.

http://pywin32.sf.net

You can then use pretty much any published example from around the net.

Example (to print the subject of each item in the inbox):

<code>
import win32com.client

outlook = win32com.client.gencache.EnsureDispatch
("Outlook.Application")
namespace = outlook.GetNamespace ("MAPI")
inbox = namespace.GetDefaultFolder
(win32com.client.constants.olFolderInbox)
for i in range (inbox.Items.Count):
  message = inbox.Items[i+1]
  print message.Subject
</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list