Integrate MailChimp in SharePoint/ ASP.net Solutions

MailChimp is an email marketing service and the trading name of its operator, it was sending over 10 billion emails per month on behalf of its users.

MailChimp integrates with the web services you already use, so you can easily sync your data, import content from other sources, and get reports on how your newsletters are impacting your business.

if you what use MailChimp on .net/C# Solutions, you can use API following the steps:

First install the NuGet package: Install-Package mcapi.net

mailchimp nuget

The following example explains how to use it.

static void Main(string[] args)
{
  const string apiKey = "6ea5e2e61844608937376d514-us2";  // Replace it before
  const string listId = "y657cb2495";                     // Replace it before
   
  var options = new List.SubscribeOptions();
  options.DoubleOptIn = true;
  options.EmailType = List.EmailType.Html;
  options.SendWelcome = false;

  var mergeText = new List.Merges("fcsharepoint@outlook.com",List.EmailType.Text)
                  {
                        {"NAME", "Fábio Carvalho"},
                   };
  var merges = new List<List.Merges> { mergeText };
  var mcApi = new MCApi(apiKey, false); 
  var batchSubscribe = mcApi.ListBatchSubscribe(listId, merges, options);
        
        if (batchSubscribe.Errors.Count > 0)
        {
            Console.WriteLine("Error:{0}", batchSubscribe.Errors[0].Message);
        }
        else
        {
            Console.WriteLine("Success");
        }
    Console.ReadKey();
    }

Useful links:

http://perceptivemcapi.codeplex.com/

http://mailchimp.com/

Thanks

Advertisements

Posted on 10/02/2016, in c#, SharePoint, Visual Studio. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: