Error adding new contact

ConnieK21
Regular Participant

Error adding new contact

I am adding a new contact and adding it to an existing list. I get an error on adding the contact list to the contact. I've followed lots of examples from the forum but still get "Object not set to an instance of an object." Any idea what I'm doing wrong?

 

        Dim newc As New Contact
        newc.EmailAddress = "abc@mydomain.com"
        newc.OptInSource = ContactOptSource.ActionByCustomer

        Dim list As New ContactOptInList
        list.ContactList = New ContactList("1")
        newc.ContactLists.Add(list)

 

2 REPLIES 2
AndrewB776
Member

Hello,

 

Thanks for posting!  This is a good one.  If the error does occur when you try to add list to newc, and not when you're setting the other two attributes, the collection musn't be initializing properly somehow.  I would suggest you take a peek at the wrapper source and make sure ContactLists is initializing properly. I would also recommend taking a look at our newer wrapper located on github here:

 

https://github.com/constantcontact/.net-sdk

 

We'll gladly support issues with the v1 wrapper, but we try to focus on the v2 wrapper.  If you have further questions, please let us know.

 


Regards,

 

Andrew B.

Constant Contact

API Support

 

 

ConnieK21
Regular Participant

Thanks. Actually, I decided the same thing. I switched completely over to the new v2 api and have everything working except a possible bug in the GetCampaignTrackingClicks. Waiting for an answer to a separate post on that. The new api is much easier to use. Very nice.

Developer Portal

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

Visit Page