我想從使用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但我還不能肯定這是正確的。當我嘗試時我沒有遇到任何錯誤,它只是變空了(沒有任何東西被拉出來)。我試圖尋找一個屬性標籤的列表,所以我可以嘗試別人,但我似乎無法找到它們。如果有人知道哪裏可以得到那些也可以幫助。
任何幫助表示讚賞。謝謝!