L
Lars Thomsen Nielsen
Outlook2003. I would like to get the phonenumbers from the listed
persons in a distributionlist. However I have some problems
defining the right folder. The code below works for my personal
addressbook, but I wish to get it to work with a distribution
list called "All address lists" -> "All Groups" -> "Local list".
I constantly gets problems when trying to change the line with
GetDefaultFolder(olFolderContacts).
Could somebody please help me to get this to work?
Sub FindPhoneNumber()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myContacts As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Dim DummyName As String
Dim DummyPhone As String
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myContacts =
myNamespace.GetDefaultFolder(olFolderContacts).Items
For Each myItem In myContacts
If (myItem.Class = olContact) Then
DummyName = myItem.FullName
DummyPhone = myItem.BusinessTelephoneNumber
End If
Next
End Sub
persons in a distributionlist. However I have some problems
defining the right folder. The code below works for my personal
addressbook, but I wish to get it to work with a distribution
list called "All address lists" -> "All Groups" -> "Local list".
I constantly gets problems when trying to change the line with
GetDefaultFolder(olFolderContacts).
Could somebody please help me to get this to work?
Sub FindPhoneNumber()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myContacts As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Dim DummyName As String
Dim DummyPhone As String
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myContacts =
myNamespace.GetDefaultFolder(olFolderContacts).Items
For Each myItem In myContacts
If (myItem.Class = olContact) Then
DummyName = myItem.FullName
DummyPhone = myItem.BusinessTelephoneNumber
End If
Next
End Sub