Microsoft KB Archive/276365

= OL2000: An Error Message Is Displayed If You Use the Members Collection of the &quot;AddressEntry&quot; Object =

Article ID: 276365

Article Last Modified on 2/26/2004

-

APPLIES TO


 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q276365



SYMPTOMS
If you use the Members collection in the Outlook object model to retrieve information about distribution lists in a Contacts folder, one of the following error messages is displayed:  Runtime error 80004002:

The messaging interface has returned an unknown error

-or- Runtime error 8004010f:

Object could not be found





CAUSE
The Members collection in the Outlook object model only functions with the Outlook Address Book. This issue can occur if:
 * You are using Outlook in Internet Mail Only (IMO) mode, which uses the Microsoft Windows Address Book. -or-


 * You are using Outlook in Corporate/Workgroup (CW) mode, but you do not have the Outlook Address Book configured in your Messaging Application Programming Interface (MAPI) profile.



WORKAROUND
To work around this issue, programmatically retrieve the distribution list objects directly from the Contacts folder. You can use the IPM.DistList message class to identify which items in the Contacts folder are distribution lists. Then you can reference members of a distribution list without using the Outlook Address Book.

The following Microsoft Visual Basic or Microsoft Visual Basic for Applications automation code sample illustrates how to retrieve information about distribution lists from the default Outlook Contacts folder. Sub DistListSummary

Dim oApp As Outlook.Application Dim oNS As Outlook.NameSpace Dim oContact As Outlook.MAPIFolder Dim oItems As Outlook.Items Dim oItem As Outlook.DistListItem

Set oApp = CreateObject(&quot;Outlook.Application&quot;) Set oNS = oApp.GetNamespace(&quot;MAPI&quot;) Set oContact = oNS.GetDefaultFolder(olFolderContacts) Set oItems = oContact.Items

sFilter = &quot;[Message Class] = 'IPM.DistList'&quot;

Set oRestrictedItems = oItems.Restrict(sFilter)

For Each oItem In oRestrictedItems strDLs = strDLs & vbLf & oItem.DLName Next

MsgBox &quot;You Have &quot; & oRestrictedItems.Count & _ &quot; DL(s) in your contact folder. Names:&quot; & strDLs

' Count the total members of all of the DLs found.

For Each oItem In oRestrictedItems intCount = intCount + oItem.Membercount Next

MsgBox &quot;Member count for all DLs is: &quot; & intCount

End Sub

