Links Collection

M

Michele

I am trying to find a way to add to the Links collection of a contact,
through vba code, two links with the same "Subject" property and I can't find
another way than the one that I will further explain.
I make a detailed example to make you well understand my problem.
I have three contacts in my Default contacts folder. Contact number 2 and
Contact number 3 have these exact properties: ContactNumber2.Title="Dr.",
ContactNumber2.FirstName="John",
ContactNumber2.MiddleName="Paul", ContactNumber2.LastName="Carter",
ContactNumber2.Suffix="Jr."; ContactNumber3.Title="Dr.",
ContactNumber3.FirstName="John",
ContactNumber3.MiddleName="Paul", ContactNumber3.LastName="Carter",
ContactNumber3.Suffix="Jr.".
The "Subject" property of a contact is always ( no matter what options you
have in the general Outlook options ) automatically filled by Outlook in this
way:
ContactItem.FirstName & " " & ContactItem.MiddleName & " " &
ContactItem.LastName & " " & ContactItem.Suffix. ( So without the Title field
)
So in my case the "Subject" property of Contact number 2 and Contact number
3 are exactly the same.
I am talking about the "Subject" property because I found that when you add
a Link to the Links collection of a contact, the added Link "Name" property
is the same as the "Subject" property of the contact.
I found also that you can't add through vba code ( and also through the
standard way to achieve that in Outlook UI ) two links with the same "Name"
property to the same collection because when you try to do that (
And in VBA you can do that only using the Links.add method that accepts as
its argument only a single object of type OlContact, so you can't input as
its argument a collection of Contacts ) Outlook simply
overrides the link that has the same "Name" property with the last one that
you added.
So the only way I found to add through code the Contact number 2 and the
Contact number 3 to the Contact number 1 links collection is to modify the
"Subject" property of Contact number 2 and Contact number 3
so that they are not anymore equal and that is working.
My worry is that I wish not to modify the "Subject" property of a contact
because it is used internally many times by Outlook, in fact as you can see
with the PropertyChangeEvent of a contact inspector
Outlook updates the "Subject" property of a contact many times when you
change (almost) any kind of properties of the contact so that means it needs
that field to be updated and equal to the construction I
made above. For example the "Subject" field is updated and used to construct
the "Display as" field of a new email address that is entered for the
contact. ( But there are many other uses of it )
Do u know any other method to add, through code, two contacts with the same
"Subject" property to a third contact links collection not modifying the
"Subject" standard property?
Thanks a lot for reading me and for any suggestion.
Ciao
 
K

Ken Slovak - [MVP - Outlook]

FullName is actually what's used, if 2 contacts have the exact same FullName
property you could only add one of them. You need different FullName
property values.
 
M

Michele

Hi Ken, thanks a lot for reading me.
I need to correct you. The Subject field of a contact is used to fill the
"Name" property of a link. Try on your own my example and you will see that i
am right, at least in my case it's so. FullName has also the Title inside it,
Subject doesn't have the Title and the name of the Links are exactly the same
as the Subject that is without the Title of the contact and in the exact
sequence i detailed in my first post.
Try also changing manually the subject of a contact and add that contact as
a Link to another contact you will see that the change you made in the
subject is reflected in the Link you added.
Anyway you confirm me unfortunatly that this is a limit of Outlook.
thanks anyway
Ciao
 

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