Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

ContactLists

dsjellz edited this page Jan 7, 2012 · 7 revisions

###Add a ContactList

<?php
$listObj = new ContactList();  
$listObj->name = "My new list";  
$List = $ConstantContact->addList($listObj);  
?>

###Get ContactLists

<?php
// Get a page of ContactLists
$lists = $ConstantContact->getLists();

// Get the next page of ContactLists
$moreLists = $ConstantContact->getLists($lists['nextLink']);
?>

###Get ContactList Details

<?php
// Get the first page of ContactLists
$lists = $ConstantContact->getLists();

// Get the details of the first list returned
$myList = $ConstantContact->getListDetails($lists['lists'][0]);
?>

###Get ContactList Members

<?php
// get a page of contact lists
$lists = $ConstantContact->getLists();

// get members for the first list found
$members = $ConstantContact->getListMembers($lists['lists'][0]);
?>

###Update a ContactList

<?php
// get a page of contact lists
$lists = $ConstantContact->getLists();

// Get the details of the first list returned
$myList = $ConstantContact->getListDetails($lists['lists'][0]);

// Modify properties and update the list
$myList->name = "Updated list Name";
$myList->sortOrder = "9";
$listUpdate = $ConstantContact->updateList($myList);
?>

###Delete a ContactList

<?php
// get a page of contact lists
$lists = $ConstantContact->getLists();

// Delete the first list returned
$deleteList = $ConstantContact->deleteList($lists['lists'][0]);
?>
Clone this wiki locally