Attaching arbitrary Id to Google Contact Address

232 Views Asked by At

I am trying to do a synchronization between Google Contacts (via their their Data API) and our internal system. I want to be able to attach our Address ID to the Google Structured Address but I can't seem to find a way.

I tried to add it as custom property, Extension Element and everything I could think of but to no avail.

My best shot was to add ExtensionFactory, it seems to go to Google (I was sniffing around and saw it going to their system) but never came back. Probably they don't accept Extension Factories / Extension Element to the addresses but only to the contacts?

So - is it possible to attach an ID to address (I know I can attach to contact but I want to be able to attach to address as one contact may have many addresses).

I am using C# and downloaded the Google Data Contacts API C# library.

Please ask for more information should you need it.

1

There are 1 best solutions below

4
On BEST ANSWER

There's no easy way to do it. The API doesn't allow attaching arbitrary data to the gd:structuredPostalAddress field.

Your best bet is to attach the data to the contact (as gd:extendedProperty) and link it to a particular address using some unique identifier. This unique identifier could be hash of the address data. Or, if you don't care about occasional misses, it could be a combination of gd:rel value and the position of the address in the list.