0

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?

gillonba
  • 897
  • 9
  • 24

1 Answers1

0

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.

DarinH
  • 4,868
  • 2
  • 22
  • 32
  • Thanks! I think the field you are thinking of is "EntryID". My first thought was to store that value in my own database, but I rejected that idea for exactly that reason. What use is a PK that is subject to change without warning? Another issue is that I anticipate using Exchange Web Services in a separate module, and I can't retrieve the EntryID from there. Right now I'm wondering about keeping a second field with the same data stored in an encrypted/hashed format to detect tampering – gillonba May 13 '11 at 14:12