C#: Company Name not being added to contacts

Occasional Visitor

C#: Company Name not being added to contacts



I am trying to develop an app that will import all of out current contacts from our CRM, and import them into a constant contact account.  I had no issues importing the contacts name and email address, but the company name refuses to get added. Im not exactly sure what needs to be done to add the complany name, the docs says that you simply need to pass a string in, but after testing on the website, it looks like a company acts as a list, letting you see who all belongs to that company. If anyone has any experiance with the C# wrapper, I would gladly appreciate the help. I will also put my code below. 


            foreach (var contact in contacts)
                //Variable to store contact data
                var contactData = new AddContactsImportData();

                if (IsValidISO(contact.FirstName))
                    contactData.FirstName = contact.FirstName;
                    Console.WriteLine(contact.FirstName + " has invalid characters");

                    contactData.LastName = contact.LastName;
                    Console.WriteLine(contact.LastName + " has invalid characters");

                if(IsValidISO(contact.EMailAddress1) && IsValidEmail(contact.EMailAddress1))
                    Console.WriteLine(contact.EMailAddress1 + " is an invalid email address");

                contactData.CompanyName = "Sparkhound";


            //list of tables to add contacts to
            var lists = new List<String>();

            var columns = new List<String>();
            columns.Add("FIRST NAME");
            columns.Add("LAST NAME");

            Console.WriteLine("About to add " + importData.Count() + " to account, press Enter to    coninue");

            var addContact = new AddContacts(importData, lists, columns);
            Activity activity = null;

                activity = constantContact.CreateAddContactsActivity(addContact);
            catch (CtctException e)
                Console.WriteLine("{0} Exception caught.", e);


Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Register for our "Making Sense of Online Marketing for Education" Webinar

Join us on Thursday, August 27th at 2pm ET for a free one-hour webinar where we will be covering how to incorporate online marketing into your educational marketing strategy.

Read More