有沒有辦法通過VBA提取此對話框中的詳細信息?爲Exchange用戶提取AddressEntry對象詳細信息
Details Dialog Box http://i.msdn.microsoft.com/dynimg/IC84336.gif
我需要的,尤其是在E-Mail地址選項卡的內容。
有沒有辦法通過VBA提取此對話框中的詳細信息?爲Exchange用戶提取AddressEntry對象詳細信息
Details Dialog Box http://i.msdn.microsoft.com/dynimg/IC84336.gif
我需要的,尤其是在E-Mail地址選項卡的內容。
當然,請使用AddressEntry.PropertyAccessor.GetProperty。
的DASL屬性名稱可以使用OutlookSpy檢索:可以單擊IAddrBook按鈕向下鑽取到特定地址條目,或者您必須將GAL收件人的一個郵件地址,點擊即時聊天按鈕,進入GetRecipientTable標籤,雙擊其中一個收件人。
我有去讀取地址簿的功能:據
Function Get_mail(Absender As String)
Dim OutApp As Outlook.Application
Dim OutTI As Outlook.TaskItem
Dim OutRec As Outlook.Recipient
Set OutApp = New Outlook.Application
Set OutTI = OutApp.CreateItem(3)
OutTI.Assign
Set OutRec = OutTI.Recipients.Add(Absender)
OutRec.Resolve
If OutRec.Resolved Then
On Error GoTo exit_function
Get_mail = OutRec.AddressEntry.GetExchangeUser.PrimarySmtpAddress
End If
exit_function: Exit Function
Set OutApp = Nothing
Set OutTI = Nothing
End Function
,因爲我知道你只能宣讀了郵件地址選項卡主郵件地址;看看還有什麼刪除部分「.PrimarySmtpAddress」,mahe的點,你應該得到其他屬性的列表。
我確定您需要Microsoft Outlook 14.0 Object Library的參考。
輸入「Absender」可以是任何字符串。如果該字符串可以解析爲Outlook電子郵件中的地址簿條目,則上述代碼也會產生積極結果。 調用的函數,例如,如果你有一個字符串「mail_adress_from_adressbook」你會把:
mail_adress_from_adressbook = get_mail("Joe Smith")
我希望這有助於 最大
你幾乎可以得到場輕鬆的E-郵件地址是更難的部分。參考文獻:Microsoft Exchange Property Tags
此代碼導出一些細節,但最重要的是將電子郵件地址導出到文本文件。
Sub ListGAL()
On Error Resume Next
Const LogFile = "C:\Test\OLK_GAL.log"
Const sSCHEMA = "http://schemas.microsoft.com/mapi/proptag/0x"
Const PR_EMS_AB_PROXY_ADDRESSES = &H800F101E
Dim oNameSpace As NameSpace, oGAL As AddressList, oEntry As AddressEntry
Dim oFSO As Variant, oLF As Variant, oExUser As ExchangeUser, i As Long
' Oulook objects
Set oNameSpace = Outlook.Application.GetNamespace("MAPI")
' Global Address List object
Set oGAL = oNameSpace.AddressLists("Global Address List")
'----------
' Log file objects
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oLF = oFSO.CreateTextFile(LogFile)
'----------
For Each oEntry In oGAL.AddressEntries
i = i + 1
Debug.Print i & vbTab & oEntry.Name
If oEntry.AddressEntryUserType = olExchangeUserAddressEntry Then
oLF.WriteLine "Entry " & i & " (olExchangeUserAddressEntry)"
oLF.WriteLine "Name: " & oEntry.Name
oLF.WriteLine "Address: " & oEntry.Address
Set oExUser = oEntry.GetExchangeUser
' SMTP ADDRESSES
oLF.WriteLine "SMTP Addresses:"
oLF.WriteLine vbTab & Join(oExUser.PropertyAccessor.GetProperty(sSCHEMA & Hex(PR_EMS_AB_PROXY_ADDRESSES)), vbCrLf & vbTab)
Set oExUser = Nothing
oLF.WriteLine String(50, Chr(151)) ' Separator
End If
Next
'----------
' Close Log File, clean up
oLF.Close
Set oGAL = Nothing
Set oNameSpace = Nothing
Set oLF = Nothing
Set oFSO = Nothing
End Sub
很晚參加派對,但如果您還沒有找到解決方案,可以使用AddressEntry.GetExchangeUser對象,該對象應包含大部分信息。有關示例,請參見[這裏](http://stackoverflow.com/a/23668368/1467082)。 –