Link between contact and task/journal

M

Matt Williamson

What field is used to create the link between an Outlook contact and a task
or journal? I need to extract all of the tasks and journals but the name in
the links collection doesn't always match if the name of the contact has
changed. I know there has to be some way that Outlook uses to link them
other than the name because they show up under the contact when I look under
tasks or journals on the Activities tab.

TIA

Matt
 
S

Sue Mosher [MVP-Outlook]

The Links collection is the correct field. Each individual Link has an Item property that returns a linked contact, if one exists.

What Outlook version are you working with?
 
M

Matt Williamson

The Links collection is the correct field. Each individual Link has an
Outlook 2003 Sp2. The problem is that the linked contact doesn't exist, yet
there has to be an identifier other than the Item.name, otherwise, how would
Outlook know to group them correctly?

Example

I have a list of tasks for a contact going back for years. During that time,
the contact name has changed multiple times. If I click on the contact field
in one of the tasks that was linked prior to the name changing, it gives me
an error message about it not existing. How does Outlook know to group that
Task with that contact on the activity tab after all of the name changes?
There has to be some sort of GUID or unique identifier because it isn't the
link.item.name any longer.

TIA

Matt
 
D

Dmitry Streblechenko

Outlook stores contact display name (which can change), but also contact
entry id and search key (which do not change unless the contact is
recreated) for each link.

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

Sue Mosher [MVP-Outlook]

Which means that if double-clicking the contact link produces a message that the contact doesn't exist, something has been done to break the link. Just changing the name of the contact would not break the link. In that case, though, I wouldn't expect the task to show up on the Activities page of the contact. Very puzzling to have two conflicting behaviors.
 
M

Matt Williamson

Outlook stores contact display name (which can change), but also contact
entry id

I compared the EntryID for each Task linked under the contact and in some
cases it is the same, but not always. It's very close though. The last 9-10
bytes change.

000000001A447390AA6611CD9BC800AA002FC45A0900079FA0FACC80B448AA2C62138ED23F040000000027490000079FA0FACC80B448AA2C62138ED23F040000000085F80000
000000001A447390AA6611CD9BC800AA002FC45A0900079FA0FACC80B448AA2C62138ED23F040000000027490000079FA0FACC80B448AA2C62138ED23F040000000085F80000
000000001A447390AA6611CD9BC800AA002FC45A0900079FA0FACC80B448AA2C62138ED23F0400000000274C0000079FA0FACC80B448AA2C62138ED23F0400000000EDB20000
000000001A447390AA6611CD9BC800AA002FC45A0900079FA0FACC80B448AA2C62138ED23F0400000000274C0000079FA0FACC80B448AA2C62138ED23F040000000123FA0000
and search key (which do not change unless the contact is recreated) for
each link.

I can't find the search key that you are talking about. Is it available
through OOM?
 
D

Dmitry Streblechenko

The entry ids are ether the same or they are not.
Search keys are not exposed through the Outlook Object Model, but you can
look at them using MFCMAPI or OutlookSpy (click IMessage).

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

Dmitry Streblechenko

If Outlook uses the search key to group, and the contact was moved between
folders (that would change the entry id under Exchange but not the search
key), this would be exactly the behavior that you see.

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

Which means that if double-clicking the contact link produces a message that
the contact doesn't exist, something has been done to break the link. Just
changing the name of the contact would not break the link. In that case,
though, I wouldn't expect the task to show up on the Activities page of the
contact. Very puzzling to have two conflicting behaviors.
 
M

Matt Williamson

The entry ids are ether the same or they are not.
Search keys are not exposed through the Outlook Object Model, but you can
look at them using MFCMAPI or OutlookSpy (click IMessage).

the PR_SEARCH_KEY field is the same for each task, but it's different for
the contact. How do I determine which contact the task belongs to as if I
clicked on the contacts, clicked the Activity tab and changed the combo to
Tasks.

TIA

Matt
 
D

Dmitry Streblechenko

You need to look at PR_SEARCH_KEY of contacts, not tasks.
The tasks store the contacts search keys in the
{00062008-0000-0000-C000-000000000046}, 0x8584, PT_BINARY
named property blob.

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

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