Jump to content

Recommended Posts

Posted

I am using Outlook 2007 VBA and I'm trying to filter out DistList items from my contacts folder. I'm using the following code:

Public contactFolder As Outlook.MAPIFolder = _

olNameSpace.GetDefaultFolder( _

Outlook.OlDefaultFolders.olFolderContacts)

Public MyContacts As Outlook.Items = contactFolder.Items.Restrict("[MessageClass] = ‘IPM.Contact’")

lstBoxContacts.Clear()

For Each contact As Outlook.ContactItem In MyContacts

If Not IsNothing(MyContacts(Ndx).Email1Address) Then

lstBoxContacts.Add(MyContacts(Ndx).FullName & " | " & MyContacts(Ndx).Email1Address)

End If

Next

I put a breakpoint at the "For Each" statement. When I checked the "MyContacts" collection it shows as empty. Can anyone tell me why that is. If I take the "Restrict" part off of the "Public MyContacts" line, the collection is not empty.


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...