Create a Suppression List Definition

This page contains information regarding creating and retrieving a suppression list definition.

Why Create and Retrieve a Suppression List Definition 

The suppression list definition allows you to associate a suppression list with a specific context, such as a send classification or a business unit. When you conduct a send in that specific context, the suppression list prevents subscribers on the list from receving that message. If multiple suppression lists apply to a single context (such as a send classification within a business unit), none of the addresses on either suppression list receives that message.

How to Create and Retrieve a Suppression List Definition 

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

Sample .NET Code 

This code sample defines all available contexts. When creating your own code, include only the contexts specific to your needs.

Create a Suppression List Definition 

1private void CreateSLD()
2{
3    ExactTarget.Integration.WSDL.SuppressionListDefinition sld = new SuppressionListDefinition();
4    sld.Name = "a name";
5    sld.Description = "a description";
6    #region Add any needed fields
7    // Specify more fields just like you would to create a Data Extension
8    sld.Fields = new DataExtensionField[1];
9    sld.Fields[0] = new DataExtensionField();
10    sld.Fields[0].Name = "Age";
11    sld.Fields[0].FieldType = DataExtensionFieldType.Number;
12    sld.Fields[0].FieldTypeSpecified = true;
13    #endregion
14    #region Add any needed contexts
15    sld.Contexts = new SuppressionListContext[6];
16    #region Add Enterprise-Operational context
17    sld.Contexts[0] = new SuppressionListContext();
18    sld.Contexts[0].Client = new ClientID();
19    sld.Contexts[0].Client.EnterpriseID = 1234;
20    sld.Contexts[0].Client.EnterpriseIDSpecified = true;
21    sld.Contexts[0].Context = SuppressionListContextEnum.Enterprise;
22    sld.Contexts[0].ContextSpecified = true;
23    sld.Contexts[0].SendClassificationType = SendClassificationTypeEnum.Operational;
24    sld.Contexts[0].SendClassificationTypeSpecified = true;
25    #endregion
26    #region Add Enterprise-Marketing context
27    sld.Contexts[0] = new SuppressionListContext();
28    sld.Contexts[0].Client = new ClientID();
29    sld.Contexts[0].Client.EnterpriseID = 1234;
30    sld.Contexts[0].Client.EnterpriseIDSpecified = true;
31    sld.Contexts[0].Context = SuppressionListContextEnum.Enterprise;
32    sld.Contexts[0].ContextSpecified = true;
33    sld.Contexts[0].SendClassificationType = SendClassificationTypeEnum.Marketing;
34    sld.Contexts[0].SendClassificationTypeSpecified = true;
35    #endregion
36    #region Add BusinessUnit-Operational context
37    sld.Contexts[0] = new SuppressionListContext();
38    sld.Contexts[0].Client = new ClientID();
39    sld.Contexts[0].Client.ID = 5678;
40    sld.Contexts[0].Client.IDSpecified = true;
41    sld.Contexts[0].Context = SuppressionListContextEnum.BusinessUnit;
42    sld.Contexts[0].ContextSpecified = true;
43    sld.Contexts[0].SendClassificationType = SendClassificationTypeEnum.Operational;
44    sld.Contexts[0].SendClassificationTypeSpecified = true;
45    #endregion
46    #region Add BusinessUnit-Marketing context
47    sld.Contexts[0] = new SuppressionListContext();
48    sld.Contexts[0].Client = new ClientID();
49    sld.Contexts[0].Client.ID = 5678;
50    sld.Contexts[0].Client.IDSpecified = true;
51    sld.Contexts[0].Context = SuppressionListContextEnum.BusinessUnit;
52    sld.Contexts[0].ContextSpecified = true;
53    sld.Contexts[0].SendClassificationType = SendClassificationTypeEnum.Marketing;
54    sld.Contexts[0].SendClassificationTypeSpecified = true;
55    #endregion
56    #region Add SendClassification context
57    sld.Contexts[0] = new SuppressionListContext();
58    sld.Contexts[0].Client = new ClientID();
59    sld.Contexts[0].Client.ID = 5678;
60    sld.Contexts[0].Client.IDSpecified = true;
61    sld.Contexts[0].Context = SuppressionListContextEnum.SendClassification;
62    sld.Contexts[0].ContextSpecified = true;
63    sld.Contexts[0].SendClassification = new SendClassification();
64    sld.Contexts[0].SendClassification.ObjectID = "some GUID";
65    #endregion
66    #region Add Send context
67    sld.Contexts[0] = new SuppressionListContext();
68    sld.Contexts[0].Client = new ClientID();
69    sld.Contexts[0].Client.ID = 5678;
70    sld.Contexts[0].Client.IDSpecified = true;
71    sld.Contexts[0].Context = SuppressionListContextEnum.Send;
72    sld.Contexts[0].ContextSpecified = true;
73    sld.Contexts[0].Send = new Send();
74    sld.Contexts[0].Send.ID = 9012;
75    sld.Contexts[0].Send.IDSpecified = true;
76    #endregion
77    #endregion
78    string requestKey = string.Empty;
79    string status = string.Empty;
80    ExactTarget.Integration.IPartnerFrameworkInterface inter = ExactTarget.Integration.Helper.GetInterfaceProxy(Principal);
81    var results = inter.Create(null, new APIObject[] { sld }, ref requestKey, out status);
82    if (status.Equals(PartnerAPICommon.StatusCodes.OK))
83    {
84// Successfully created it
85// Go get the ObjectID
86        for (int i = 0; i < results.Length; i++)
87        {
88            string newID = results[i].NewObjectID;
89        }
90    }
91}

Retrieving a Suppression List Definition 

1private void RetrieveSLD()
2{
3    #region Build the Retrieve Request
4    ExactTarget.Integration.WSDL.RetrieveRequest rr = new RetrieveRequest();
5    rr.ObjectType = "SuppressionListDefinition";
6    rr.Properties = new string[] { "ObjectID", "CustomerKey", "Name", "Category", "Client.CreatedBy", "CreatedDate", "Client.ModifiedBy", "ModifiedDate", "Client.ID", "Client.EnterpriseID", "Description" };
7    #region Set the filter criteria
8    ExactTarget.Integration.WSDL.SimpleFilterPart sfp = new SimpleFilterPart();
9    rr.Filter = sfp;
10    #region Retrieve a single item
11    sfp.Property = "ObjectID";
12    sfp.SimpleOperator = SimpleOperators.equals;
13    sfp.Value = new string[1] { "the ID from above" };
14    #endregion
15    #region Retrieve all items in a folder
16    sfp.Property = "Category";
17    sfp.SimpleOperator = SimpleOperators.equals;
18    sfp.Value = new string[1] { "CategoryID" };
19    #endregion
20    #endregion
21    #endregion
22    #region Make the call
23    APIObject[] results = null;
24    string requestID = null;
25    string status = null;
26    ExactTarget.Integration.IPartnerFrameworkInterface inter = ExactTarget.Integration.Helper.GetInterfaceProxy(Principal);
27    status = inter.Retrieve(rr, ref requestID, out results);
28    #endregion
29    #region Process the results
30    if (status.Equals(PartnerAPICommon.StatusCodes.OK) || status.Equals(PartnerAPICommon.StatusCodes.MoreDataAvailable))
31    {
32    for (int i = 0; i < results.Length; i++)
33        {
34            // Do something with the results
35        }
36    }
37    #endregion
38}

Retrieve All Contexts Associated with a Suppression List Definition 

1private void RetrieveAllContextsAssociatedWithAnSLD()
2{
3    #region Build the Retrieve Request
4    ExactTarget.Integration.WSDL.RetrieveRequest rr = new RetrieveRequest();
5    rr.ObjectType = "SuppressionListContext";
6    rr.Properties = new string[] { "ObjectID", "Definition.ObjectID", "Definition.CustomerKey", "Definition.Name", "Definition.Category", "Definition.Description"
7, "Context","SendClassification.ObjectID","Send.ID","SendClassificationType"
8, "Client.CreatedBy", "CreatedDate", "Client.ModifiedBy", "ModifiedDate", "Client.ID", "Client.EnterpriseID"};
9    #region Set the filter criteria
10    ExactTarget.Integration.WSDL.SimpleFilterPart sfp = new SimpleFilterPart();
11    rr.Filter = sfp;
12    #region Retrieve the contexts associated with an SLD
13    sfp.Property = "Definition.ObjectID";
14    sfp.SimpleOperator = SimpleOperators.equals;
15    sfp.Value = new string[1] { "the ID from above" };
16    #endregion
17    #endregion
18    #endregion
19    #region Make the call
20    APIObject[] results = null;
21    string requestID = null;
22    string status = null;
23    ExactTarget.Integration.IPartnerFrameworkInterface inter = ExactTarget.Integration.Helper.GetInterfaceProxy(Principal);
24    status = inter.Retrieve(rr, ref requestID, out results);
25    #endregion
26    #region Process the results
27    if (status.Equals(PartnerAPICommon.StatusCodes.OK) || status.Equals(PartnerAPICommon.StatusCodes.MoreDataAvailable))
28    {
29        for (int i = 0; i < results.Length; i++)
30        {
31            // Do something with the results
32            }
33    }
34    #endregion
35}