I tried this code to find contacts in GAL by jobtitle,
Sub FindEmailsByJobTitle()
Dim olApp As Outlook.Application
Dim oGAL As Outlook.AddressList
Dim oContacts As Outlook.AddressEntries
Dim oContact As Outlook.ContactItem
Dim oResults As Outlook.Items
Dim sFilter As String
Dim sJobTitle As String
Set olApp = Outlook.Application
Set oGAL = olApp.Session.AddressLists("Global Address List")
sJobTitle = "MANAGER"
sFilter = "@SQL=" & Chr(34) & "urn:schemas:contacts:JobTitle" & Chr(34) & " LIKE '%" & sJobTitle & "%'"
Set oResults = oGAL.AddressEntries.GetFirst().AddressList.Find(sFilter) 'this is error
If Not oResults Is Nothing Then
For Each oContact In oResults
Debug.Print oContact.Address
Next oContact
Else
MsgBox "No contacts found."
End If
Set oResults = Nothing
Set oContacts = Nothing
Set oGAL = Nothing
Set olApp = Nothing
End Sub
but throw an error with error message "Object doesn't support this property or method"
thanks for help ^_^