The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

creating a campaign


creating a campaign


please help me out to create the string builder to create a campaign. 

I use the following string builder to create a contact list. Do i need to create the string builder in the same way. Please advice me. Please send me a modal if you don't mind.



private string CreateaContactList(string sUserName, string sPassWord, string Listame) //success



        string sCampUri = "" + sUserName + "/lists";

        string sAPIKey = "84325c7d-79ae-4754-aeeb-788006cc0745";

        Uri address = new Uri(sCampUri);

        HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;

        request.Credentials = new NetworkCredential((sAPIKey + "%" + sUserName), sPassWord);

        request.Method = "POST";

        request.ContentType = "application/atom+xml";


        StringBuilder data = new StringBuilder();


        data.Append(@"<entry xmlns="""">");




        data.Append(@"<updated>" +System.DateTime.Now.ToString()+"</updated>");

        data.Append(@"<content type=""application/vnd.ctct+xml"">");

        data.Append(@"<ContactList xmlns="""">");


        data.Append(@"<Name>" + Listame + "</Name>");





        //Email Address,Email Type,First Name,Last Name

        byte[] byteData = UTF8Encoding.UTF8.GetBytes(data.ToString());

        string st = String.Empty;

        request.ContentLength = byteData.Length;

        using (Stream postStream = request.GetRequestStream())


            postStream.Write(byteData, 0, byteData.Length);



            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)


                // Get the response stream  

                StreamReader reader = new StreamReader(response.GetResponseStream());

                st = reader.ReadToEnd();


return st;


Thanks in advance,



Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More