Newbie Question

Mar 21, 2011 at 2:22 PM

I am trying to batch subscribe to a list and need some assistance.  I would like to add values for FNAME and LNAme as well as emails.  I am stuck on how to use the batch and merges types. 

Thanks for the help. Here is my code:


Dim apikey As String
Dim pingreturn As String
Dim CustomerListID As String
Dim ListSubscribeResult As Boolean

apikey = "mailchimpkey"

Dim mailchimp As New MailChimp.MCApi(apikey, True)
pingreturn = mailchimp.Ping()
CustomerListID = "listid"

Dim Batchsubscribe As MailChimp.Types.List.BatchSubscribe
Dim merges As New MailChimp.Types.List.Merges
merges.Add("EMAIL", pstrEmailSubscriberEmail)
merges.Add("FNAME", pstrEmailSubscriberFirstName)
merges.Add("LNAME", pstrEmailSubscriberLastName)
merges.Add("EMAIL_TYPE", "html")

Batchsubscribe = mailchimp.ListBatchSubscribe(CustomerListID, merges)

Mar 21, 2011 at 2:59 PM
Edited Mar 21, 2011 at 3:14 PM


U need to supply IEnumerable<MailChimp.Types.List.Merges> as second parameter of ListBatchSubscribe function, say Array or List<>:



Dim mergesSeq() As MailChimp.Types.List.Merges = { merges0, merges1, merges 2 } ' where merges_i contain EMAIL, FNAME etc

Batchsubscribe = mailchimp.ListBatchSubscribe(CustomerListID, mergesSeq)