creating a campaign

Regular Participant

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