Sub snoopContacts(strContact As String)
Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim targetFolder As Outlook.MAPIFolder
Dim targetItems As Outlook.Items
Dim targetContact As Outlook.ContactItem
Dim strFilter As String
Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set targetFolder = nms.GetDefaultFolder(olFolderContacts)
'strFilter = "[FullName]=" & Chr(34) & strContact & Chr(34)
'Set targetItems = targetFolder.Items.Restrict(strFilter)
Set targetItems = targetFolder.Items
For Each targetContact In targetItems
With targetContact
Debug.Print .NickName, .FirstName, .LastName, .CompanyName
End With
Next
Set targetContact = Nothing
Set targetItems = Nothing
Set targetFolder = Nothing
Set nms = Nothing
Set objOutlook = Nothing
End Sub
I would like to get a very simple example witch loops through the contacts
folder and debugs the result and also how to create contacts change them and
delete them I´m using Microsoft Outlook 10.0 Object Library
So please help me get started
thank you
Mustapha