I am new to VSTO, and am developing an addon to Outlook that will allow the end users to track relationships between contacts. The relationships are stored in a separate SQL database, and I put the ID of the SQL data row in a custom property attached to the Outlook contact. Unfortunately, if the user ever views the “All Fields” pane, this ID is visible under “User-defined fields for this item”. Is there any way to prevent the user from being able to see (and more importantly edit) these properties?
Share
I don’t believe there’s any way to “attach” data to OL contacts that can’t be seen by the user.
On the other hand, you could have a field in you DB that tracks the Contact ID (I forget the exact field name offhand, but I know each contact has a unique key value associated with it) and then use THAT when getting to the data in your SQL DB.
The only problem with that approach is that outlook has a habit of resetting that PK value when you do certain things (like move a contact from one folder to another, Outlook treats that as a DELETE/ADD, so the PK for the contact will change).
I seem to recall using a hybrid approach at one point that did BOTH (stored the PK of the contact in SQL and a custom field in the Contact stored a SQL ID) and then just keeping them synched. But as I recall, it was a bit of a pain.
alternately, if the user moved a contact, YOU could also treat it as a DELETE/ADD and update your SQL as applicable.