Python 使用MAPI从GAL检索电子邮件列表
这是我目前的代码:Python 使用MAPI从GAL检索电子邮件列表,python,mapi,gal,Python,Mapi,Gal,这是我目前的代码: 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.Co
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
alias = i.Address.split("=")[-1]
print i.GetExchangeUser().PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A56101E")
我从以下地点获得财产:
但出于某些原因,我得到了这个错误:
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, u'Microsoft Outlook', u'The property "http://schemas.microsoft.com/mapi/proptag/0x3A550003" is unknown or cannot be found.', None, 0, -2147221233), None)
我做错了吗?您不能假设
PR\u CONTACT\u EMAIL\u ADDRESSES
或任何其他MAPI属性将可用。您是否确实可以在(单击IAddrBook,“打开根容器”等)中看到该特定对象上的属性
为什么您需要该属性?您是否尝试过ExchangeUser.PrimarySmtpAddress