![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
Ads |
#2
|
|||
|
|||
![]()
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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Michele" wrote in message ... 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 |
#3
|
|||
|
|||
![]()
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 "Ken Slovak - [MVP - Outlook]" wrote: 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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Michele" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Data Collection Add-in Error | jz | Outlook - Installation | 0 | October 24th 08 06:35 PM |
adding a distlist item to the links collection | Michael Kensy | Outlook and VBA | 10 | December 6th 07 06:49 AM |
get addresses from a collection of emails | marek | Outlook - Using Contacts | 2 | October 3rd 07 06:25 PM |
Links NG in newsgroups; e-mail links work OK (More) | POP | Outlook Express | 1 | June 20th 06 12:37 PM |
how to use the CommandBars Collection | Jim B | Outlook - Using Forms | 0 | January 22nd 06 01:46 AM |