0
我在這種情況下必須導入組織中的所有聯繫人,包括羣組或羣組聯繫人。我有我在某處找到的這段代碼,但這不包括聯繫人組。這隻會導入聯繫人。Outlook中的導入聯繫人/ Nab羣組
Sub Email_Extract()
Dim colAL As Outlook.AddressLists
Dim oAL As Outlook.AddressList
Dim colAE As Outlook.AddressEntries
Dim oAE As Outlook.AddressEntry
Dim oExUser As Outlook.ExchangeUser
Dim n As Long
Set colAL = Outlook.Application.Session.AddressLists
For Each oAL In colAL
StartTime = Timer
If oAL.AddressListType = olExchangeGlobalAddressList Then
Set colAE = oAL.AddressEntries
n = 2
For Each oAE In colAE
If oAE.AddressEntryUserType = olExchangeUserAddressEntry Then
Set oExUser = oAE.GetExchangeUser
ThisWorkbook.Sheets("Sheet1").Cells(n, 1).Value = oExUser.Name 'User Name
ThisWorkbook.Sheets("Sheet1").Cells(n, 2).Value = oExUser.PrimarySmtpAddress 'SMTP address
n = n + 1
Cells(n, 1).Activate
End if
Next
Endif
Next
End sub
請注意,它的運行時間取決於組織的電子郵件地址。我發現了一些信息here但這個想法有點懸而未決。無論如何,我可以在這個過程中包括聯絡小組?請幫忙。謝謝。