Contacts folder does not expose AddressEntries

C

ClownLounge

I have a problem with a contacts folder not exposing its AddressEntries
to a VB6 COM Add-In (Outlook: 9.0.0.2711, CDO: 1.2.1, Win2k).

The Add-In sends messages/documents to email/fax/SMS etc. For this to
happen, the user first selects specific contact items in a contacts
folder and then calls the AddIn. The add-in then maps the selected
contacts to its corresponding CDO AddressEntries (using an
AddressEntries filter and then checking the contact item ID versus the
AddressEntry ID).

However, in some cases, the contacts folder does not expose its
contacts as AddressEntries, which causes the above matching algorithm
to fail. I have checked that the contacts folders' properties that the
folder is shown as an email address book of the same name.

Here's a code snippet:

Dim list As MAPI.AddressList
Dim aeList As MAPI.AddressEntries
Set list = cdoSession.AddressLists("Contacts")
Set aeList = list.AddressEntries
mLog.log " CDO address entries " & aeList.Count

This code is already in production since about 2 years and worked fine
(aeList.Count > 0). However, recently, some users complained that they
can't select contacts anylonger when using the AddIn. I checked the
logs and aeList.Count is 0.

Since on most other machines it works I believe it must be an
Outlook/Exchange configuration, which I can't figure out.

If anyone has an idea or had similar problems, please reply.
Thanks
-Stefan
 
S

Sue Mosher [MVP-Outlook]

For testing purposes, I'd iterate cdoSession.AddressLists to see what lists
are available. Maybe the users affected have phantom Contacts lists. The
cure for that would be to remove the Outlook Address Book from the profile,
then add it back in after restarting Outlook.

Just curious: Could you share your technique for matching ContactItem
EntryID values with AddressEntry ID values? That's someone people ask about
often.

FYI, there is a newsgroup specifically for general Outlook programming
issues "down the hall" at microsoft.public.outlook.program_vba or, via web
interface, at
http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba
 
C

ClownLounge

Sue, thanks for the reply: I've done iterating through the AddressLists
and the Contacts list is available, however with 0 AddressEntries
(aeList.Count would otherwise fail).
What is a phantom Contact list (ie. what leads to a user having such a
list)?

As for the matching algorithm:

I am using a MAPI.AddressEntryFilter filter, which I set to the contact
items subject.
Then I iterate through the result set (usually between 1 and 3) and
check the ID of the contact item against the ID of the AddressEntry.

If InStr(entry.id, obj.EntryID) > 0 Then
'Match
End If

Although slow, this works because OTOH the contact items ID of the OOM
is the same as the CDO AdressEntry ID, but missing the last 8
characters.

I also looked into filtering on the ID in the AddressEntry filter, but
got a MAPI_TOO_COMPLEX error.

Sorry for the crosspost (I realized later and posted it on your
suggested group)
-Stefan
 
S

Sue Mosher [MVP-Outlook]

Outlook contacts folders can become phantoms if the user moves the .pst
file, has a bad upgrade experience from OL2000 IMO, or probably several
other undocumented causes. Removing the Outlook Address Book service, then
adding it back in is the cure.

That's a nice simple algorithm. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top