Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / November 2004

Tip: Looking for answers? Try searching our database.

Finding a corresponding contact item from a recipient entryid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stefan - 11 Nov 2004 11:53 GMT
I have to find a contact corresponding to a recipient in an outlook
task item. Once I found a function GetContactEntryID that maps an
recipient entryId to a contact by truncating and converting the id.
This worked fine until now but with OL2003/Ex2003/WinXP SP2 it seems
to not work any more.
In newsgroups, I have also found many advices to make a search or
restrict on the contact items by the email address or the name but
this is not enough for me: the name or email address of the contact
could have changed in the meantime. I assume that there has to be a
reliable solution since also Outlook can do this: a doubleclick on a
recipient in a mail message takes me to the corresponding contact even
if I changed name/email of this contact.
Any ideas around?
Thanks very much for any help.
Stefan
Dmitry Streblechenko \(MVP\) - 11 Nov 2004 22:25 GMT
Look at that function's source code and see what fails by comparing what it
produces with what it must produce.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> I have to find a contact corresponding to a recipient in an outlook
> task item. Once I found a function GetContactEntryID that maps an
[quoted text clipped - 11 lines]
> Thanks very much for any help.
> Stefan
Stefan - 12 Nov 2004 08:09 GMT
Dmitri
I've included the function's source code below. In my example the
variable fBytes gets a value of 1.953658E+09 so GetContactEntryID
always is an empty string.

Stefan

Public Function GetContactEntryID(AddressEntryId As String) As String
  On Error GoTo ErrorHandler

  Dim sAddressEntryID As String
  Dim sBytes As String
  Dim fBytes As Single
 
  GetContactEntryID = ""
  sAddressEntryID = AddressEntryId
  If Len(sAddressEntryID) >= 72 Then
      sBytes = Mid$(sAddressEntryID, 65, 8)
      fBytes = 0
      fBytes = fBytes + (Val("&H" & Mid$(sBytes, 1, 2)))
      fBytes = fBytes + (Val("&H" & Mid$(sBytes, 3, 2)) * (2 ^ 8))
      fBytes = fBytes + (Val("&H" & Mid$(sBytes, 5, 2)) * (2 ^ 16))
      fBytes = fBytes + (Val("&H" & Mid$(sBytes, 7, 2)) * (2 ^ 24))
      If Len(sAddressEntryID) >= (72 + (fBytes * 2)) Then
          GetContactEntryID = Mid$(sAddressEntryID, 73, fBytes * 2)
      End If
  End If
  Exit Function

ErrorHandler:

  GetContactEntryID = ""

End Function

> Look at that function's source code and see what fails by comparing what it
> produces with what it must produce.
[quoted text clipped - 19 lines]
> > Thanks very much for any help.
> > Stefan
Dmitry Streblechenko \(MVP\) - 12 Nov 2004 17:12 GMT
Ok, and when you step through the function when running under Outlook 2003,
what is different compared to the same address entry's entryid under Outlook
2002?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> Dmitri
> I've included the function's source code below. In my example the
[quoted text clipped - 54 lines]
> > > Thanks very much for any help.
> > > Stefan
Stefan - 15 Nov 2004 13:45 GMT
Here's a working example:
sAddressEntryID:
00000000FE42AA0A18C71A10E8850B651C24000003000000040000000000000046000000000000004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F069000000001EB250000A7FA4349428AE448AE43535670036F2C000000CF000B0000000000

fbytes gets a value of 70 and
so GetContactEntryID gets a value of:
000000004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F069000000001EB250000A7FA4349428AE448AE43535670036F2C000000CF000B0000

in a non  working examples I get for
sAddressEntryID:
00000000812B1FA4BEA310199D6E00DD010F5402000001104D75737465722C204B75727400534D5450006B756D75407A69636B2E636800

fbytes then gets 1.953658E+09 resulting in an empty GetContactEntryId

And I'm not really sure about the "working" environment. I traced both
examples with Outlook 2003, but the first was created maybe with
Outlook 2002. But for sure, all newly created contacts don't work.

Any idea? You need more info?

Thanks, Stefan

> Ok, and when you step through the function when running under Outlook 2003,
> what is different compared to the same address entry's entryid under Outlook
[quoted text clipped - 66 lines]
> > > > Thanks very much for any help.
> > > > Stefan
Dmitry Streblechenko \(MVP\) - 15 Nov 2004 17:40 GMT
What I mean is take the address entry entryid and the corresponding
ContactItem entryid and compare the two to see what you need to delete
(prefix and suffix) from the address entry entryid.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> Here's a working example:
> sAddressEntryID:

00000000FE42AA0A18C71A10E8850B651C240000030000000400000000000000460000000000
00004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F06900000
0001EB250000A7FA4349428AE448AE43535670036F2C000000CF000B0000000000

> fbytes gets a value of 70 and
> so GetContactEntryID gets a value of:

000000004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F0690
00000001EB250000A7FA4349428AE448AE43535670036F2C000000CF000B0000

> in a non  working examples I get for
> sAddressEntryID:

00000000812B1FA4BEA310199D6E00DD010F5402000001104D75737465722C204B7572740053
4D5450006B756D75407A69636B2E636800

> fbytes then gets 1.953658E+09 resulting in an empty GetContactEntryId
>
[quoted text clipped - 76 lines]
> > > > > Thanks very much for any help.
> > > > > Stefan
Stefan Hunziker trueware - 16 Nov 2004 08:13 GMT
That's my problem: I don't see any match between the two id's. Look at the
second example where the address entryid is

00000000812B1FA4BEA310199D6E00DD010F5402000001104D75737465722C204B75727400534D5450006B756D75407A69636B2E636800

The corresponding ContactItem's entryid is as follows:

000000004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F069000000001EB250000A7FA4349428AE448AE43535670036F2C000000CF000C0000

So there is obviously no prefix or suffix to delete as in example 1...

> What I mean is take the address entry entryid and the corresponding
> ContactItem entryid and compare the two to see what you need to delete
[quoted text clipped - 118 lines]
>> > > > > Thanks very much for any help.
>> > > > > Stefan
Dmitry Streblechenko \(MVP\) - 16 Nov 2004 21:16 GMT
Hmmm... and you got both entry ids in the same Outlook session on the same
machine, right? I certainly don't see the same behavior in Outlook 2003,
whether it is running using PST or Exchange.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> That's my problem: I don't see any match between the two id's. Look at the
> second example where the address entryid is

00000000812B1FA4BEA310199D6E00DD010F5402000001104D75737465722C204B7572740053
4D5450006B756D75407A69636B2E636800

> The corresponding ContactItem's entryid is as follows:

000000004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F0690
00000001EB250000A7FA4349428AE448AE43535670036F2C000000CF000C0000

> So there is obviously no prefix or suffix to delete as in example 1...
>
[quoted text clipped - 9 lines]
> >> Here's a working example:
> >> sAddressEntryID:

00000000FE42AA0A18C71A10E8850B651C240000030000000400000000000000460000000000

00004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F06900000
> > 0001EB250000A7FA4349428AE448AE43535670036F2C000000CF000B0000000000
> >>
> >> fbytes gets a value of 70 and
> >> so GetContactEntryID gets a value of:

000000004FE5D0522F4EB648B4A39E1DFA72F58D0700AE8EBDE02BF08D4FA2EF19D6B94F0690
> > 00000001EB250000A7FA4349428AE448AE43535670036F2C000000CF000B0000
> >>
> >> in a non  working examples I get for
> >> sAddressEntryID:

00000000812B1FA4BEA310199D6E00DD010F5402000001104D75737465722C204B7572740053
> > 4D5450006B756D75407A69636B2E636800
> >>
[quoted text clipped - 92 lines]
> >> > > > > Thanks very much for any help.
> >> > > > > Stefan
news.solnet.ch - 17 Nov 2004 21:54 GMT
I think I've found the cause for this bivalent behaviour: The "not working"
example is a contact that is created in Outook object model using a custom
contact form. On this form there is a list for defining of the family
members. These are then created using cdo. And the such created entry ids
are "working" as usual.

> Hmmm... and you got both entry ids in the same Outlook session on the same
> machine, right? I certainly don't see the same behavior in Outlook 2003,
[quoted text clipped - 156 lines]
>> >> > > > > Thanks very much for any help.
>> >> > > > > Stefan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.