Topic: Getting subscribers in groups

I've been poking around with ExactTarget API using WCF in .NET 3.5, but has come to a halt. The code below works flawlessly, writing all groups complete with ID, Name and Category, but I was wondering how to get the list of subscribers. There is a property Subscribers on the Group-object, which is null, but how do I retrieve the list of subscribers along with the groups?

          Response.Write("--- Groups ---<br />\n");

          // Get all groups
          SimpleFilterPart sfp = new SimpleFilterPart();
          sfp.Property = "ID";
          sfp.SimpleOperator = SimpleOperators.isNotNull;
          sfp.Value = new String[] { };

          RetrieveRequest rr = new RetrieveRequest();
          rr.ObjectType = "Group";
          rr.Properties = new string[] { "Category", "ID", "Name" };
          rr.Filter = sfp;

          // Execute the Retrieve call
          APIObject[] results;
          string requestID;
          string status = client.Retrieve(rr, out requestID, out results);

          Response.Write("RequestID: " + requestID + "<br />\n");
          Response.Write("Status: " + status + "<br />\n");
          Response.Write("Elements:" + results.Length + "<br />\n");

          Response.Write("Category - ID - Name<br />\n");
          for (int i = 0; i < results.Length; i++)
          {
            Group gr = (Group)results[i];
            Response.Write(String.Format("{0} - {1} - {2}", gr.Category, gr.ID, gr.Name));
            if (gr.Subscribers != null)
            {
              Response.Write("Subscribers<br />\n");
              foreach (Subscriber sub in gr.Subscribers)
              {
                Response.Write("Subscriber: " + sub.EmailAddress + "<br />");
              }
            }
            Response.Write("<br />\n");
          }

I have tried changing the code to eg.:

          rr.Properties = new string[] { "Category", "ID", "Name", "Subscribers.Subscriber.EmailAddress" };

and

          rr.Properties = new string[] { "Category", "ID", "Name", "Subscribers.EmailAddress" };

I can not find an ObjectType "GroupSubscriber" for the RetrieveRequest either. Any input is mostly welcome!

Last edited by Techek (2010-06-17 09:08:40)

Coding for ExactTarget using WCF in C# .NET 3.5