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.

API C# GetUserContactListCollection not returning all lists

Highlighted
Regular Visitor

API C# GetUserContactListCollection not returning all lists

None of the new lists I have created through the ConstantContact website are coming back through the api call GetUserContactListCollection()

 

If I use the ConstantContact website to change the sort order, the lists come back through API sorted properly (so doesn't seem like a browser caching issue) but my newly created list(s) will be ignored/omitted from the results, no matter if i order it first, last, or in the middle. I have less than 50 lists so it's not in a different "chunk" of data either. Is there some setting on the list that make it available to the API?

 

My code:

 

protected void LoadLists()

{

 

cbLists.Items.Clear();

       

string nextChunkId;

       

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

       

foreach (ContactList cl in lists)

{

            ListItem l = newListItem();

            l.Text = cl.Name;

            l.Value = cl.Id;

            l.Selected = false;

            cbLists.Items.Add(l);

}

 

} // end LoadLists()

2 REPLIES 2
Highlighted
Employee

Re: API C# GetUserContactListCollection not returning all lists

Hey,

 

The sort order is only referenced from with in the Constant Contact graphic user interface.  The api does not return the contact lists as the sort order value.  It is going to return the lists in the order of the ID's.  I am not a C# expert, however I believe you could still do this by sorting the ContactList object by the value of sortOrder. You can find an example on how to do this here.

 

Please let me know if that helps.

Ryan Davis
Quality Engineer
Highlighted
Regular Visitor

Re: API C# GetUserContactListCollection not returning all lists

First, I truly appreciate you taking the time to respond to my question because this is driving me insane.

 

My issue isn't with the sort, that's actually working and returning items properly sorted...which is somewhat confusing since you expected it not to? But that's a whole different discussion...

 

My issue is when I call GetUserContactListCollection() from the api, it doesn't return all of my lists. I have less than 50 lists, so its not in "the next chunk of data". I was using the sort example as proof that it is not a browser caching issue...I can change the sort order on the constant contact website and the lists come back in the newly sorted order through the api call. I have figured out that the missing lists through the api are the lists that I have newly created since getting a developer api key. FYI - These new lists I am creating are through the constant contact website (not the api).

 

My expectation was I could add a new list and then a call through the api would pull that new list with all of the rest of my lists, but that is not happening and I don't know why? Is there some sort of setting that makes lists available/visible through the api? Do I need to get a new developer key in order to see any newly created lists? Is there something simple I am missing here?

 

Thanks again for your help!

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