In a previous post we introduced a c# library that simplifies interactions with Eloqua's REST API. In today's post, we'll demonstrate how to use this library to create and manage your Contact Lists.

We'll assume that you've already imported the dll and constructed the client, see the following post for details.

 

We'll start by creating a new Contact List.

(Notice that we're including some members, represented by their Contact IDs : 1, 2)

 

ContactList list = new ContactList
                              {
                                   id = -1,
                                   name = "sample",
                                   membershipAdditions = new List<string> {"1", "2")
                              };

 

Next, we'll invoke a simple request to create the list :

 

ContactList createdList = client.Assets.ContactList.Post(list);
var listId = createdList.id;

 

You've just created your list!

 

The next step is to add/remove members from the list. You can do this by manipulating the following properties :

  • membershipAdditions
  • membershipDeletions

 

// remove a member from the list
createdList.membershipDeletions = new List<string>{"1"}
client.Assets.ContactList.Put(createdList);

 

We hope that you find this helpful.

 

Please note that the REST API is not yet public and the code samples available here are my own work. I'll be glad to help support and fix issues in the code, but please understand that Eloqua will not be able to support this - as it is my own.

 

Thanks,

Fred