Current version:outlook 2016 and window 7 enterprise
Have tried the script below, but it did not pull and save the attachment to my path.
However, it works fine when i am using outlook 2010 and Windows 7 Enterprise.
Kindly advise
Below is my script
import win32com.client
import os
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
folder=outlook.Folders("xxx@xxx.com").Folders("E News Letters").Folders("DAILY_Subscribe to our newsletters")
path01 = os.path.expanduser("D:\\Users\\xxx\Desktop\\Projects")
messages = folder.Items
message = messages.GetFirst()
for m in messages:
if "DAILY_Subscribe to our newsletters" in str(message):
try:
print (message)
attachments = message.Attachments
attachment = attachments.Item(1)
print(os.getcwd() + "\\" + str(attachment))
attachment.SaveASFile(path01 + "\\" + str(attachment)) #Saves to the attachment to current folder
print (attachment)
message = messages.GetNext()
except:
print (attachment)
else:
continue