C# Batch Create Contact Set Email

Tags: 

I am trying to do a Batch Create of Contacts, I am setting the First and Last Name of the customer, but I am having issues setting the Email Address for the customer. My code is below, any help would be greatly appreciated:

GenericField firstGenericField = createGenericField("First", createStringDataValue(customer.firstName),DataTypeEnum.STRING);

GenericField lasGenericField = createGenericField("Last", createStringDataValue(customer.lastName),DataTypeEnum.STRING);

GenericField[] personNameFieldList = new GenericField[] { firstGenericField, lasGenericField };

GenericField contactGenericField = createGenericField("Name", createObjectDataValue("PersonName",personNameFieldList), DataTypeEnum.OBJECT);

GenericField emailGenericField = createGenericField("Emails", createStringDataValue(customer.email),DataTypeEnum.STRING);

GenericField[] emailFieldList = new GenericField[] { emailGenericField };

GenericField contactEmailGenericField = createGenericField("Emails", createObjectDataValue("EmailsList",emailFieldList), DataTypeEnum.OBJECT);

GenericField[] contactGenericFieldList = new GenericField[] { contactGenericField, contactEmailGenericField };

Zircon - This is a contributing Drupal Theme
Design by WeebPal.