python - 搜索更多列 - Python , Outlook
问题描述
下面的代码只搜索名称。但是,我想使用更多列选项对电子邮件进行搜索。有什么办法吗?
import win32com.client
search_string = 'doe@doe.com'
outlook = win32com.client.gencache.EnsureDispatch('Outlook.Application')
gal = outlook.Session.GetGlobalAddressList()
entries = gal.AddressEntries
ae = entries[search_string]
email_address = None
if 'EX' == ae.Type:
eu = ae.GetExchangeUser()
email_address = eu.PrimarySmtpAddress
if 'SMTP' == ae.Type:
email_address = ae.Address
print('Email address: ', email_address)
解决方案
无需搜索,您可以让 Outlook 找到匹配项 - 调用Application.Session.CreateRecipient
/ Recipient.Resolve
。
推荐阅读
- proxy - 使用来自 azure sdk 的 MQTT 协议的应用程序在公司代理后面不起作用
- android - java.lang.IllegalStateException:CameraX 尚未初始化
- javascript - 如果特定的 div 在视口中淡入音频,如果 div 不在视口中淡出
- r - 如何绘制对数后验的轨迹(直至成比例)?
- mysql - Mysql 5.7 重复键的声明处理程序中的问题
- azure - 如何正确使用 CosmosDb 处理大于 2 Mb 的文档
- mysql - 多赛事锦标赛积分榜(任意数量的参赛作品)
- sql-server - 尝试在数据库中循环并创建函数时出现 SQL 错误
- html - Bootsrap 4 在移动设备上重叠粘性侧边栏
- c - 如何计算最长路径问题的复杂性?