试图找到一个人的电子邮件和这个人的直线经理。我使用下面的代码:
import win32com.client
o = win32com.client.gencache.EnsureDispatch("Outlook.Application")
ns = o.GetNamespace("MAPI")
adrLi = ns.AddressLists.Item("Global Address List")
contacts = adrLi.AddressEntries
numEntries = adrLi.AddressEntries.Count
nameAliasDict = {}
for i in contacts:
name = i.Name
email = i.Address
manager = i.Manager
alias = i.Address.split("=")[-1]
nameAliasDict[alias] = name
if "David" in name: # any David's email and his manager's email address
print (email, manager)
但它不会返回电子邮件地址和个人经理的电子邮件。
获得它的正确方法是什么?(反之亦然,知道一个人的名字,得到他的下属。)
谢谢你。