We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

api v2 C# - how to get contacts from "do-not-mail" list

Regular Participant

api v2 C# - how to get contacts from "do-not-mail" list

In v1 of API, you could do something like the code below to fetch the members of the do not mail list.  I don't even see this list in the results from the "contact list collection."  Nor can you fetch it by list id of "do-not-mail"


String nextLink;
List<Contact> contacts = (List<Contact>) Utility.getListMembers("/ws/customers/"+authdata.Username+"/lists/do-not-mail", authdata, out nextLink);
while(nextLink != ""){
      List<Contact> nextPageContacts = (List<Contact>)    Utility.getListMembers("https://api.constantcontact.com"+nextLink, authdata, out nextLink);



Hi Rich,


We are working to add functionality to the V2 API so that it can retrieve system lists (e.g. removed, do-not-mail, active, etc).  There currently isn't a way to do so in V2.  I will follow up with our product manager to make sure it is in the pipeline.  Thanks!


Best Regards,

Shannon W.

API Support Specialist

Where is this feature at?

This feature has actually been released since our launch in April, just in a slightly different way than we had done in the V1 API.  To get all the Contacts with a specific subscription status, you would do a GET agains the Contacts collection and filter based on status.  Our documentation on this is found here: http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html

Dave Berard
Senior Product Manager, Constant Contact

This isn't the way the C# libraries in github work.   While the "listId"  in CTCT.ConstantContact.GetContactsFromList is typed as string, it only supports integers, maybe down at the service level.  I haven't had time to debug it yet.  So with an integer for listId, there's no way to specify "OPTOUT" or "REMOVED".






I've been using the version 1 API for these calls where you can do:


Utility.getListMembers("do-not-mail", _auth, out nextLink);


Utility.getListMembers("removed", _auth, out nextLink);



It looks like we haven't added the status query parameter to the GetContacts call.  The GetLists call will no longer support system lists, only user defined lists (which is why you are getting the invalid ID error).  See our documentation for how the status query parameter works for the Contacts collection.


Will get this in the queue to add to the C# wrapper.  If you are unable to wait, feel free to do the update to the wrapper and request a pull and we'll look over the request and merge it in if there aren't any problems.  If not, it could be a couple of weeks to get this added as we are doing so other major updates at the same time.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page