Showing results for 
Search instead for 
Did you mean: 

C# SDK -- Remove contact from specific list

Occasional Participant

Re: C# SDK -- Remove contact from specific list

The above code also deletes the FirstName and LastName (probably more fields) of the contact. For as much information about your SDK and your Wrapper you supply there is a lot missing. I would think that removing a contact from a list would be a pretty common function.


Re: C# SDK -- Remove contact from specific list

Hi Judy,


Your code is pretty close to correct, though it should not remove any information you already have (such as FirstName or LastName).  You would just need to add one line.  This is because in C#, the .add() method just adds another item to the collection, not overwriting or changing.  Without clearing the list, the API would correctly just append the new list and keep all the original lists.


Since you're pulling all of the data from us, including the original FirstName and LastName, you should not be losing any data in the update here.  I haven't experienced this in my tests of the C# wrapper, all my updates using your code are correctly keeping the information the same.  If you keep running into that problem, plesae check to make sure that your Contact c correctly has the values in it after calling Utility.GetContactDetailsById(authdata, ContactId) method before you're sending the update. 


Contact c = Utility.GetContactDetailsById(authdata, ContactID);

ContactOptInList newList = new ContactOptInList();


newList.ContactList = new ConstantContactBO.ContactList("33");

c.ContactLists.Clear(); // Add this line to clear out original lists, otherwise you are appending instead of changing



c.OptInSource = ContactOptSource.ActionByCustomer;

Utility.UpdateContactFullForm(authdata, c);

Dave Berard
Senior Product Manager, Constant Contact
Occasional Visitor

Re: C# SDK -- Remove contact from specific list

Hi Andrew,


"Our API takes the submitted XML for Lists and completely wipes out the old data for the new data."


This behavior isn't what I just experienced. I am trying to move a contact from a list to another and I am doing so by sending a PUT request with the list node only containing one list (the list to move the contact to).


What I experienced is that the API returns a contact assigned to no list (list node empty), while the website shows the contact in both list (the old and the new one).


Could you help?




Honored Contributor

Re: C# SDK -- Remove contact from specific list

Hello Richard,


It is the intended behavior that a contact should change to match the data that is sent by the application and what you are seeing is not the intended or normal behavior. In ordre to look into what is happening, we will need details on the contact that you are working on, as well as the account that you are working with.


If it is possible, it would be best to email us at with the following info:


- Username for the Constant Contact account where you are having issues

- Email address of the contact that is being worked on

- If possible, the contact ID of the contact that is being worked on


Best Regards,


Elijah G.
API Support Engineer