The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Error adding new contact

Highlighted
Occasional Contributor

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
Highlighted
Regular Advisor

Re: Error adding new contact

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

 

 

Highlighted
Occasional Contributor

Re: Error adding new contact

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

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured