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

JLandon
Regular 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
David_J
Employee

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