Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用MAPI从GAL检索电子邮件列表_Python_Mapi_Gal - Fatal编程技术网

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