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.

How to get all the contacts based on a ContactList id

DivyaR
Regular Participant

How to get all the contacts based on a ContactList id

Hello,

 

I am trying to get all the data from contacts table based on a particular Contact List id (which belongs to ContactList table). I am doing it in my dotnet web application(vb.net).

 

I am using  Utility.GetContactCollection(auth, nextChunkId) to get all the contacts irrespective of any filter query.

 

Now the problem is i am just not getting how to relate both the above table (Contacts and ContactList). Do we have any direct function call or method provided by Constant contact to fetch all contacts based on another table id?

 

Please suggest me how to go about it. 

Thank you.

 

 

8 REPLIES 8
Ryan_D
Employee

Hey Divyar,

 

You can use the getListMembers() method to get the members of a particular list.

Ryan Davis
Quality Engineer
SarahB592
Regular Participant

I don't seem to have the getListMembers() method in the Utilities.cs file that came with the CC sample C# code. However, that is what I am trying to do.  Where do I find that method? 

The sample forms have some limitations, and weren't made for full development. I'd suggest taking a look at the .NET Library for implementation into your app. This should have all the functions you need.

 

If this is the code you originally used, I'd suggest taking a look to see that you have the most recent version, then let us know if you're still not able to use this function.

Nick Galbraith
Support Engineer
SarahB592
Regular Participant

Nick,

 

Sorry, but am a bit confused (new to CC API), but isn't the sample code that I dowloaded from the Constant Contact site the most current?  Why do you recommend I go to github?  I did try and download the ZIP from github, but I couldn't open the solution due to VS version issues (I am running 2010 Ultimate.)

 

What I am trying to acheive is a sync between our in-house data and what is at CC...particulary what lists users have opted-in or out of.  I have read the "Searching for Contacts by Last Updated Date (Synchroni​zing Contacts)" article found at... http://community.constantcontact.com/t5/Documentation/Searching-for-Contacts-by-Last-Updated-Date-Sy...

However, there are so many caveats listed that I remain at a loss as to level of effort this will take. Like the article suggestes, I want to perform the sync operation 1x day....perhaps via Windows Service or Scheduled Task.  Is there sample available for such a sync?

 

This is not to say the sample code that I was able open wasn't appreciated - it was, and very much so.  Making a connection, authenticating, excuting a POST and binding back the data...alll very informative and well done.

I'm not sure which sample code you are currently working with, as we do have 2 sample forms (one for contacts, and one for email campaigns), and a full Library for easier functions. Depending on which version you have used, certain functions may not be available. I wanted to direct you to the most recent version of the full library, just to make sure you were using the version that was intended for development.

 

If you let me know which version you were able to use successfully, I can get a better idea of what functions are available to you.

Nick Galbraith
Support Engineer
SarahB592
Regular Participant

Nick,

 

I am using the contact forms.  The zip file I downloaded has an "ASP Upload Forms" folder.  I am not certain the name of the zip file though it appears as if I downloaded the package on 3/28/2012.

 

I just downloaded "ctctsupport-Constant-Contact-Dot-Net-ASP-Contact-Forms-2b6dd5f.ZIP".  I opened the solution (had to update it to VS2010), and searched the entire solution for "getListMembers"...came up empty.

 

Perhaps it just simply wasn't included in the sample's DLL's?

The Contact forms are an older example of how to use our API in C#.  The full wrapper of our API is only available in the C# .NET wrapper project.  If you're using VS2010, you will get an error saying that the project uses an earlier version of VS (we develop all the wrappers in VS2008 for maximum distribution).  The import the project, you will need to convert it to a 2010 project.  Just open the project by itself in VS2010 and a wizard will take you through the rest of the steps. 

Dave Berard
Senior Product Manager, Constant Contact
SarahB592
Regular Participant

I finally got the latest code - thank you.  I am still looking into this sync with our in-house data. I cannot get the data back from the GetContactCollection() method, but the GetListMembers() is working well.  I will most likely be opening other threads as I work through the code.  Thanks again!

Developer Portal

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

Visit Page