1

到目前为止,这是我的代码:

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")

我从以下位置获取财产:https ://msdn.microsoft.com/en-us/library/bb446002.aspx

但由于某些原因,我收到此错误:

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)

我做错了吗?

4

1 回答 1

1

您不能假定该PR_CONTACT_EMAIL_ADDRESSES属性或任何其他 MAPI 属性将可用。你真的能在OutlookSpy中看到那个特定对象的属性吗(单击 IAddrBook、“打开根容器”等)?

为什么你需要那个属性?你试过ExchangeUser.PrimarySmtpAddress吗?

于 2015-10-27T14:02:17.063 回答