2

I'm trying to find the total number of subscribers that are within a specific ExactTarget list. I have the ListID, and am successfully connecting to the list. Since the list has about 1 million subscribers, when I try to pull the subscribers with that ListID, it takes a really long time.

All I want is the number of subscribers. I don't need any information of theirs, just the amount that is apart of the list. Here's the simple code below:

//Make new request for number of subscribers in "All Subscribers" list
RetrieveRequest listSubscriberRequest = new RetrieveRequest();
listSubscriberRequest.ObjectType = "ListSubscriber";
listSubscriberRequest.Properties = new String[] { "SubscriberKey", "Status" };

 // Setting up a simple filter to look at ListID
 SimpleFilterPart sf = new SimpleFilterPart();
 sf.SimpleOperator = SimpleOperators.equals;
 sf.Property = "ListID";
 sf.Value = new String[] { listId };

 listSubscriberRequest.Filter = sf;

 APIObject[] listSubscriberResults = null;
 String listSubscriberRequestId = null;
 String listSubscriberResponse = null;
 int totalSubscribers = 0;

 //Retrieve subscribers, add length of return to total every retrieve
 do
 {
     listSubscriberResponse = soapClient.Retrieve(listSubscriberRequest, out listSubscriberRequestId, out listSubscriberResults);
     totalSubscribers += listResults.Length;
 }
 while (listSubscriberResponse.Equals("MoreDataAvailable")); //Continue to loop until end of subscribers

I want to be able to get rid of that do while because it is taking 10+ min.

1
  • I edited to add "exacttarget" as most reading this may assume "list" means an Apex list.
    – Jagular
    Commented Jun 25, 2014 at 15:06

1 Answer 1

1

If you have the System DataViews turned on. You can create a query activity that does the aggregation based on the list ID (ListSubscribers). When you want to get that information, you can execute the query definitions via the API and wait for it to complete (Perform Query) or schedule it depending on your data freshness needs. Then query your DataExtension and filter by your list id.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .