Update a Subscriber List

Why Update a Subscriber List 

You can make sure the information about your subscriber list is as current as possible using the Update call.

How to Update a Subscriber List 

Use the sample code below as a model for your own API call.

Sample .NET Code 

1using System;
2using System.Configuration;
3using System.Data;
4using System.Linq;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.HtmlControls;
9using System.Web.UI.WebControls;
10using System.Web.UI.WebControls.WebParts;
11using System.Xml.Linq;
12using etAPI;
13public partial class ListUpdate : System.Web.UI.Page
14{
15    //Global Variables
16    private SoapClient client = new SoapClient();
17    protected void Page_Load(object sender, EventArgs e)
18    {
19        //Authenticate
20        client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationSettings.AppSettings["wsUserName"];
21        client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationSettings.AppSettings["wsPassword"];
22        if (!IsPostBack)
23        {
24        }
25    }
26    protected void btnSubmit_Click(object sender, EventArgs e)
27    {
28        try
29        {
30            //Create a GUID to ensure a unique key
31            string strGUID = System.Guid.NewGuid().ToString();
32            //Create List object [Subscribers > My Subscribers > My Lists]
33            List l = new List();
34            l.ID = 12345;//required
35            l.IDSpecified = true;
36            l.Description = "Test List UPDATED from API";
37            try
38            {
39                string uRequestID = String.Empty;
40                string uStatus = String.Empty;
41                //Call the Update method on the List object
42                UpdateResult[] uResults = client.Update(new UpdateOptions(), new APIObject[] { l }, out uRequestID, out uStatus);
43                //Display Results
44                lblMessage.Text += "Overall Status: " + uStatus;
45                lblMessage.Text += "<br/>";
46                lblMessage.Text += "Number of Results: " + uResults.Length;
47                lblMessage.Text += "<br/>";
48                //Loop through each object returned and display the StatusMessage
49                foreach (UpdateResult ur in uResults)
50                {
51                    lblMessage.Text += "Status Message: " + ur.StatusMessage;
52                    lblMessage.Text += "<br/>";
53                }
54            }
55            catch (Exception ex)
56            {
57                //Set Message
58                lblMessage.Text += "<br/><br/>UPDATE ERROR:<br/>" + ex.Message;
59            }
60        }
61        catch (Exception exc)
62        {
63            //Set Message
64            lblMessage.Text += "<br/><br/>###ERROR<br/>" + exc.Message;
65        }
66    }
67}

See Also