我想从使用VBA的Outlook.ExchangeUser对象中拉出一些属性。我可以拉的大部分我所需要的,除了一些数据似乎使用Exchange extended attributes使用VBA拉取Microsoft Exchange自定义/扩展属性?
问题存储:
- 是否有可能拉使用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但我还不能肯定这是正确的。当我尝试时我没有遇到任何错误,它只是变空了(没有任何东西被拉出来)。我试图寻找一个属性标签的列表,所以我可以尝试别人,但我似乎无法找到它们。如果有人知道哪里可以得到那些也可以帮助。
任何帮助表示赞赏。谢谢!