I'm trying to read messages that are in folders in Outlook 2010, and I'm 
running into trouble. Between looking at other folk's code and trying to make 
sense out of the Microsoft Object Model documentation, I've been able to figure 
out how to read items in the inbox and other things in default folders, such as 
tasks:    by using GetDefaultFolder.
 
----------------------------------------------------
import win32com.client
 
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
 
# Count the number of messages in the inbox
inbox = outlook.GetDefaultFolder(win32com.client.constants.olFolderInbox)
messages = inbox.Items
print "number of messages in inbox:", messages.Count
 
# Count the number of tasks in the task list
task_list = outlook.GetDefaultFolder(win32com.client.constants.olFolderTasks)
tasks = task_list.Items
print "number of tasks in the task list:", tasks.Count
 
-----------------------------------------------------
 
But I can’t figure out how to read folders that aren’t default folders – i.e., 
inbox, deleted items, sent items – but instead are folders that I’ve created.  
If the folders were located under the Inbox, it’d be  pretty straightforward, 
but they aren't.  And I’ve yet to find any examples or anything in the Object 
Model that’ll help me (which could be because I still don't quite understand 
it), and poking around using  dir() hasn’t  helped very much.
 
Any pointers on how to figure this out?

I'm running Outlook 2010 under Vista and using python 1.5 (for compatibility 
with Vocola)
 
Thanks,
Anders Schneiderman
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to