'Python with Outllok win32.client question
i am trying to access the "recipient" outlook object in python 3.9 using win32.clients import, but can only access "recipients". Recipients does not have an "address" property, but "recipient" does to get the recipients email address from an outbox as desired. anyone have a work around or other recommended libraries to accomplish this? the recipient object exists, i just cant access it docs.microsoft.com/en-us/office/vba/api/outlook.recipient
import win32com.client as win32
import os
from datetime import datetime, timedelta
messageobjectlist = []
reciplist = []
messages = outbox.Items
received_dt = datetime.now() - timedelta(days=1)
received_dt = received_dt.strftime('%m/%d/%Y %H:%M %p')
messages = messages.Restrict("[ReceivedTime] >= '" + received_dt + "'")
for each in messages:
if each.Class == 43:
messageobjectlist.append(each)
for x in messageobjectlist:
reciplist.append(x.Recipients) #this is the problem, if i try to grab addresses from this, "recipients" does not have the property, only "recipient" does, but python tells me "recipient" is unknown
print(x)
for y in reciplist:
print(y)
#this is the output from the code above, unknown coms instead of desired addresses
back up code
RE: Group Kickoff
RE: Thank You
RE: spac-research_1652212493196.csv
Outlook Programmatic Permissions
RE: (cmts 5.10.22)
RE: - Fully Executed LOE
RE: - Fully Executed LOE
RE: - Fully Executed LOE
FW: logo
RE: Expense report
RE: Expenses - Moving & November Visit
FW: Thank You
RE: - Advisory (May 2022) (cmts 5.10.22)
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
<COMObject <unknown>>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|