Created
July 31, 2018 08:29
-
-
Save Shobin23/6d2af8b0a65328fafdd1621622933f73 to your computer and use it in GitHub Desktop.
For vs While
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32com.client | |
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") | |
inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case, | |
# the inbox. You can change that number to reference | |
# any other folder | |
messages = inbox.Items | |
message = messages.GetFirst() | |
rec_time = message.CreationTime | |
body_content = message.body | |
subj_line = message.subject | |
#--------- This works----------------- | |
#while message: | |
# print(message.subject, message.CreationTime) | |
# message = messages.GetNext() | |
#---------This doesnt ---------------- | |
#for mess in range(message): | |
# print(mess.subject, mess.CreationTime) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment