Charles de M.
Charles de M.

Reputation: 693

How to read a Google Contact vcf-file and converting non-standard items to a list

My goal is to read an exported google-contacts file containing the contacts in vcf-format and store the contacts in my own contacts table (in SQL Server). I have dedicated columns for Spouse (string), and Children (string[]).

I use the converter of Folker Kinzel (FolkerKinzel.VCards), which is very extensive. Each contact has fields with the name of father, mother or spouse. That field is defined by a label.

The export file structure is as follows

 BEGIN:VCARD
 VERSION:3.0
 FN:Dr. William Nicoloas Henry DeCamp MD
 N:DeCamp;William;Nicoloas Henry;Dr.;MD
 EMAIL;TYPE=INTERNET;TYPE=HOME:[email protected]
 EMAIL;TYPE=INTERNET;TYPE=WORK:[email protected]
 EMAIL;TYPE=INTERNET:[email protected]
 TEL;TYPE=CELL:9654324937
 TEL:698765432
 ADR;TYPE=HOME:;;10 Whitechapel rd.;Whiteplains;;NY0011;USA;WhiteChapelroad\nNY0011    Whiteplains\nUSA
 ORG:ACME Corp
 TITLE:Manager
 BDAY:19860629
 item1.X-ABRELATEDNAMES:George
 item1.X-ABLabel:_$!<Father>!$_
 item2.X-ABRELATEDNAMES:Lisa
 item2.X-ABLabel:_$!<Mother>!$_
 item3.X-ABRELATEDNAMES:Kerry
 item3.X-ABLabel:_$!<Partner>!$_
 item4.X-ABRELATEDNAMES:Jaimy
 item4.X-ABLabel:_$!<Child>!$_
 NOTE:QmId: 3088
 CATEGORIES:myContacts
 END:VCARD

However, when reading the converted file, the X-ABRELATEDNAMES and the X-ABLABEL have become separate items, as shown here:

enter image description here

The Group (item1...item3) is a property of each AB-element.

Can you recommend a way to use that property to allocate the right name to the right label again?

For example

var item1 = (item1.label, item1.value)

I have tried to find a way in FolkerKinzel to get the order changed around (item1{ABLABEL, ABRELATEDDNAMES}), but I could not find a way.

Upvotes: 0

Views: 17

Answers (0)

Related Questions