【发布时间】:2017-02-14 16:23:09
【问题描述】:
我正在尝试使用 VBA 从 Outlook.ExchangeUser 对象中提取一些属性。我可以提取我需要的大部分内容,除了一些似乎使用Exchange extended attributes 存储的数据
问题:
- 是否可以使用 VBA 拉取扩展属性?
- 如果是,怎么做?
这里有一些代码可以说明我在做什么(这是 Microsoft Excel 文件中的 VBA 代码):
...
Dim myOlApp As Outlook.Application
Dim addrList As AddressList
Dim exchUser As Oulook.ExchangeUser
...
Set myOlApp = CreateObject("Outlook.Application")
Set addrList = myOlApp.GetNamespace("MAPI").addressLists("SOMELIST")
Set exchUser = addrList.addressEntries("doe, john").GetExchangeUser
...
然后我可以使用 Exchange 用户对象提取属性。即...
MsgBox ("User company name: " + exchUser.CompanyName)
如果我尝试执行上述操作来提取扩展属性,则会收到类似“对象不支持此属性或方法”的错误。我尝试了以下方法无济于事:
exchUser.msExchangeAttributeX '(where X is a number from 1-15)
exchUser.ms-Exch-Extension-Attribute-X
exchUser.CustomAttributeX
exchUser.ExtensionCustomAttributeX
我也尝试过使用 PropertyAccessor...
exchUser.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x802D001E")
我从here 获得了架构,但我并不肯定这是正确的。当我尝试这样做时,我没有收到错误,它只是空着回来(没有任何内容被拉出)。我尝试查找属性标签列表,以便可以尝试其他标签,但似乎找不到它们。如果有人知道从哪里可以得到这些,那可能也会有所帮助。
感谢任何帮助。谢谢!
【问题讨论】:
标签: excel outlook exchange-server-2010 vba