VB6 / Redemption / Outlook Contacts

  • Thread starter Thread starter Mike V
  • Start date Start date
M

Mike V

I have an application which integrates (usually) with Outlook via the
redemption.dll to access a Contact folder allowing the user to retrieve
names and then the selected contact record.

Generally it works fine but two problems have cropped up in the past
week that have me stumped and I haven't found any relief from past
Usenet postings or the MS knowledge base.

The first problem is that at a couple of installations our application
successfully establishes a connection to the user's contact folder but
when they do a search it comes up empty, even when searching for a name
that is clearly in the contact folder. I am using the MAPITable object
with the Items.Restrict method to select the contacts:

Set MAPITable = CreateObject("Redemption.MAPITable")
sFilter = "[MessageClass]='IPM.Contact' AND [FileAs] >= 'smi'
AND [FileAs] < 'smiz'" (The 'z' is appended by me so that the search
will return all 'smi*' matches
MAPITable.item = m_objOutlookFolder.Items.Restrict(sFilter)

The clients are running XP Pro / Outlook 2003. In the vast majority of
installations it works fine... but in the past week I have had this
problem twice and haven't been able to figure it out. One side note,
our application allows users add new contacts to the Outlook contact
folder. In this case if they add a new contact it is visible to the
Outlook application, but still won't be visible to our application.


Second problem (different installation):

When our application tries to establish a connection with Outlook it
gets the following message: "Microsoft Outlook Error: -1940651692. An
OLE registration error occurred. The program in not correctly
installed. Run setup for the the program."

The computer is XP Pro / Outlook 2003. The little information I have
found from searching the web suggests reinstalling IE 6.0. But I am
hesitant to recommend that to the client unless there is some rational
for it. I'm hoping maybe someone else has run into this and knows the
cause.

Sorry for the long message. Any suggestions would be very much
appreciated.
 
In the second problem does the code work if you manually register your
application?

The first problem sounds odd but you might want to try two things. First,
see if it makes any difference if you first explicitly assign an Items
collection from your Outlook object model restriction and then assign that
Items collection to the MAPITable.Item. The other suggestion is to get rid
of that restriction completely and use a MAPITable filter to do it all in
one.




Mike V said:
I have an application which integrates (usually) with Outlook via the
redemption.dll to access a Contact folder allowing the user to retrieve
names and then the selected contact record.

Generally it works fine but two problems have cropped up in the past
week that have me stumped and I haven't found any relief from past
Usenet postings or the MS knowledge base.

The first problem is that at a couple of installations our application
successfully establishes a connection to the user's contact folder but
when they do a search it comes up empty, even when searching for a name
that is clearly in the contact folder. I am using the MAPITable object
with the Items.Restrict method to select the contacts:

Set MAPITable = CreateObject("Redemption.MAPITable")
sFilter = "[MessageClass]='IPM.Contact' AND [FileAs] >= 'smi'
AND [FileAs] < 'smiz'" (The 'z' is appended by me so that the search
will return all 'smi*' matches
MAPITable.item = m_objOutlookFolder.Items.Restrict(sFilter)

The clients are running XP Pro / Outlook 2003. In the vast majority of
installations it works fine... but in the past week I have had this
problem twice and haven't been able to figure it out. One side note,
our application allows users add new contacts to the Outlook contact
folder. In this case if they add a new contact it is visible to the
Outlook application, but still won't be visible to our application.


Second problem (different installation):

When our application tries to establish a connection with Outlook it
gets the following message: "Microsoft Outlook Error: -1940651692. An
OLE registration error occurred. The program in not correctly
installed. Run setup for the the program."

The computer is XP Pro / Outlook 2003. The little information I have
found from searching the web suggests reinstalling IE 6.0. But I am
hesitant to recommend that to the client unless there is some rational
for it. I'm hoping maybe someone else has run into this and knows the
cause.

Sorry for the long message. Any suggestions would be very much
appreciated.
 
see if it makes any difference if you first explicitly assign an
Items
collection from your Outlook object model restriction and then assign that
items collection to the MAPITable.Item. The other suggestion is to get rid
of that restriction completely and use a MAPITable filter to do it
all in one.

I'm not sure what that means. Here's my current code, is there a
better way to do this?

Dim MAPITable As Object
Dim vColumns(Columns.colStateOrProvince) As Variant

Set MAPITable = CreateObject("Redemption.MAPITable")
MAPITable.item = m_objOutlookFolder.Items.Restrict(sFilter)

' Assign requested values
vColumns(Columns.colEntryID) = PR_ENTRYID
vColumns(Columns.colLongTermEntryID) =
PR_LONGTERM_ENTRYID_FROM_TABLE
vColumns(Columns.colFirstName) = PR_FIRST_NAME
vColumns(Columns.colMiddleName) = PR_MIDDLE_NAME
vColumns(Columns.colLastName) = PR_LAST_NAME
vColumns(Columns.colJobTitle) = PR_JOB_TITLE
vColumns(Columns.colCompanyName) = PR_COMPANY_NAME
PR_LAST_MODIFICATION_TIME
vColumns(Columns.colLocality) = PR_LOCALITY
vColumns(Columns.colStateOrProvince) = PR_STATE_OR_PROVINCE

MAPITable.Columns = vColumns
Set GetContactsMAPITable = MAPITable

Thanks for your help.
 
Suggestion #1 would look like this:

Dim colRestrict As Outlook.Items

Set colRestrict = m_objOutlookFolder.Items.Restrict(sFilter)
MAPITable.item = colRestrict

I'm not saying it would work but it might and it would let you set a
breakpoint there and see the results of your restriction.

My other suggestion involves using the Filter property of a MAPITable and
setting the filter to the MAPI equivalent of your Outlook object model
restriction using the MAPI property tags for the properties you want to
restrict on. You can see various examples of that sort of thing on the
Redemption Web site.
 
Back
Top