Deletes a subscriber list. This action doesn't delete the subscribers on that list. When a list is deleted, no further sends can be conducted with that list.
When you delete a subscriber list, your account also loses all tracking information related to that subscriber list. For this reason, we recommend leaving lists intact and creating new lists via new opt-in procedures.
Use thesee code examples to construct your own API calls.
Sample .NET Code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using etAPI;
public partial class ListDelete : System.Web.UI.Page
{
//Global Variables
private SoapClient client = new SoapClient();
protected void Page_Load(object sender, EventArgs e)
{
//Authenticate
client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationSettings.AppSettings["wsUserName"];
client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationSettings.AppSettings["wsPassword"];
if (!IsPostBack)
{
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
//Create List object [Subscribers > My Subscribers > My Lists]
List l = new List();
l.ID = 1007548;//required
l.IDSpecified = true;
try
{
string dRequestID = String.Empty;
string dStatus = String.Empty;
//Call the Delete method on the List object
DeleteResult[] dResults = client.Delete(new DeleteOptions(), new APIObject[] { l }, out dRequestID, out dStatus);
//Display Results
lblMessage.Text += "Overall Status: " + dStatus;
lblMessage.Text += "<br/>";
lblMessage.Text += "Number of Results: " + dResults.Length;
lblMessage.Text += "<br/>";
//Loop through each object returned and display the StatusMessage
foreach (DeleteResult ur in dResults)
{
lblMessage.Text += "Status Message: " + ur.StatusMessage;
lblMessage.Text += "<br/>";
}
}
catch (Exception ex)
{
//Set Message
lblMessage.Text += "<br/><br/>UPDATE ERROR:<br/>" + ex.Message;
}
}
catch (Exception exc)
{
//Set Message
lblMessage.Text += "<br/><br/>###ERROR<br/>" + exc.Message;
}
}
}
SOAP Envelope Example
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<a:Action s:mustUnderstand="1">Delete</a:Action>
<a:MessageID>urn:uuid:12345</a:MessageID>
<ActivityId CorrelationId="12345" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">123456</ActivityId>
<a:ReplyTo>
<a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<o:UsernameToken u:Id="uuid-b82c6428-caa1-49fc-986b-dc613c990c49-1">
<o:Username>XXXXX</o:Username>
<o:Password>XXXXX</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DeleteRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options></Options>
<Objects xmlns:q1="http://exacttarget.com/wsdl/partnerAPI" xsi:type="q1:List">
<q1:ID>12345</q1:ID>
<q1:ObjectID xsi:nil="true"></q1:ObjectID>
</Objects>
</DeleteRequest>
</s:Body>
</s:Envelope>