I’ve had a few requests to get more details on how I used the WCF REST Starter Kit to integrate with the Constant Contact AtomPub API (posted here). It’s shamefully simple but here it is. If you are not satisfied I will give you your money back.
Requires:
- .NET Framework 3.51
- WCF REST Starter Kit Preview 2
- NUnit/Log4net (included)
- Constant Contact Developer Account
Notes:
- Update the app.config with your account settings from Constant Contact.
- Sample is using Http Digest for authentication. If there is interest I can update for OAuth.
using System.Configuration;
using System.Collections.Generic;
using Freemind.Domain.Email;
namespace Freemind.ConstantContactSample
{
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("Begin loading Contact Lists");
// Connect and list Contact Lists
ContactListProvider provider = new ContactListProvider(
ConfigurationManager.AppSettings["ConstantContactAccountName"],
ConfigurationManager.AppSettings["ConstantContactPassword"]);
List lists = provider.GetContactLists();
if (lists != null)
{
foreach (ContactList list in lists)
{
Console.WriteLine(" list:{0} id:{1}", list.Name, list.id);
}
}
Console.WriteLine("Completed loading Contact Lists");
Console.WriteLine("Press any key to quit");
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}",ex.Message);
}
}
}
}


