OL2000: An Error Message Is Displayed If You Use the Members Collection of the "AddressEntry" Object (276365)



The information in this article applies to:

  • Microsoft Outlook 2000

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("Outlook.Application")
   Set oNS = oApp.GetNamespace("MAPI")
   Set oContact = oNS.GetDefaultFolder(olFolderContacts)
   Set oItems = oContact.Items

   sFilter = "[Message Class] = 'IPM.DistList'"

   Set oRestrictedItems = oItems.Restrict(sFilter)

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

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

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

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

   MsgBox "Member count for all DLs is: " & intCount

End Sub
				

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:

146636 OL2000: Questions About Custom Forms and Outlook Solutions


Modification Type:MinorLast Reviewed:2/26/2004
Keywords:kberrmsg kbprb KB276365