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.

.Net Lib - Contact does not belongs to any contact list

Highlighted
Participant

.Net Lib - Contact does not belongs to any contact list

Hi..


I'm trying to add a contact I receive the following error:



Contact does not belongs to any contact list



How do you add a contact using the .Net Lib?


this doesn't work...



 



Contact c = new Contact("joe@aol.com", "Joe", "Blow");Utility.CreateNewContact(authdata, c);

THANKS IN ADV



 


 


 

1 REPLY 1
Highlighted
Employee

Re: .Net Lib - Contact does not belongs to any contact list

In order for a contact to be added to your account, they need to be subscribed to at least one contact list. In the example below, the contact would be added list id 1, which is the 'General Interest' list by default.


Contact c = new Contact("joe@aol.com", "Joe", "Blow");



ContactOptInList cl = new ContactOptInList();

c.OptInSource = ContactOptSource.ActionByContact;

cl.ContactList = new ConstantContactBO.ContactList("1");

c.ContactLists.Add(cl);



Utility.CreateNewContact(authdata, c);

You can get a full listing of all the contact lists in your account by doing the following:


string nextChunkId;

IList<ContactList> lists = Utility.GetUserContactListCollection(authdata, out nextChunkId);

I hope this helps. Please let us know if you have any questions regarding this.

David J

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