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.

Getting Next Page with .NET API

Established Member

Getting Next Page with .NET API

I don't know how to get the next page of results when using the C# .Net API.


I can get the first page using:


var clist = _constantContact.GetContacts(lastModified);


I've tried things like:


var myPage = new CTCT.Components.Pagination();

myPage.Next = clist.Meta.Pagination.GetNextUrl();

clist = _constantContact.GetContacts(lastModified, myPage);


with no success.   

Anyone know how to do this?

Honored Contributor

Re: Getting Next Page with .NET API



You're actually very very close! With your example where clist is set as the ResultSet containing the first page of contacts, you can get the second page like this:

// Set up a list to hold all of the contacts from each page.
List<Contact> contacts = new List<Contact>();

// Get the first page
var clist = _constantContact.GetContacts(lastModified);

// store the first page

// Get the next page. To do this,you have to provide the actual pagination object rather than just the URL.
clist = _constantContact.GetContacts(lastModified, clist.Meta.Pagination);

// store the next page


You will want to keep in mind this is a very basic example. If you don't have a predictable number of pages, it would likely be best to set up a loop of some sort to repeat the process until there is not another page. In addition, with this method all of the contacts are compiled as you go.


Let me know if you have any questions!



Elijah G.

API Support Specialist

Elijah G.
API Support Engineer
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