Obviously VBA seemed like the most recommended option so I had some exploring to do.
Enter the GetExchangeUser method which is available in Office 2007
- Create a Email message with the list of contacts you want to export and save it as a Draft
- Go to the Draft foldert and select the email message
- Enter the VBA mode in Outlook and create a new module, paste the below code and execute
- You will see all contacts in your email message exported to the default Contacts folder in Outlook with the properties you specified in the code
- From here you can just use the Import/Export feature in outlook to export the Contact list to excel.
Sub AddToContactsFromEmail()
Dim olkContacts As MAPIFolder, olkContact As ContactItem, olkSelected As Selection, olkItem As Object, olkRecipient As Recipient
'Select the email in outlook from which you want the contacts added
Set olkSelected = Application.ActiveExplorer.Selection
If olkSelected.Count > 0 Then
For Each olkItem In olkSelected
If olkItem.Class = olMail Then
Set olkContacts = Application.Session.GetDefaultFolder(olFolderContacts)
For Each olkRecipient In olkItem.Recipients
Set olkContact = Application.CreateItem(olContactItem)
With olkContact
.FullName = olkRecipient.Name
.Email1Address = olkRecipient.Address
.BusinessAddress = olkRecipient.AddressEntry.GetExchangeUser.Address
.OfficeLocation = olkRecipient.AddressEntry.GetExchangeUser.OfficeLocation
.BusinessTelephoneNumber = olkRecipient.AddressEntry.GetExchangeUser.BusinessTelephoneNumber
.JobTitle = olkRecipient.AddressEntry.GetExchangeUser.Alias
'Enter additional properties required from GAL
.Categories = "Exported"
.Save
End With
Next
End If
Next
End If
Set olkContact = Nothing
Set olkContacts = Nothing
Set olkSelected = Nothing
Set olkItem = Nothing
Set olkRecipient = Nothing
End Sub
Note: There is cvsde utility that exists apparently in the Windows Server that helps you export GAL but I wasnt able to locate the utility on my client machine.
No comments:
Post a Comment