1. Hi, very nice tutorial. Very helpful. One thing is not working:

                var model = await Manager.Members.GetAllAsync("f809a0eba9", new MemberRequest { 
                   Limit = 100, 
                   Status = Status.Subscribed 

    This parameter is not working: Status = Status.Subscribed (or any other Status, nothing is passed to model)

    1. Hi @MVafx,

      I haven’t had a chance to look at this but it’s possible the Status object might be broken in a new release of the library. Try rolling back to version 1.9.1 and see if that fixes the problem. If not, there is something else wrong with your code.

      Update, 30 October 2017: See Rohit’s comment below.

  2. @MVafx,

    I faced the same issue and chatted with the mailchimp support, please also set “StatusIfNew” flag to Status.Subscribed as well, then it will work.


  3. Hi Doug, I know it’s a stupid question, but I don’t understand why this code works fine during the debug session instead of the release mode in production.
    Sorry but I’m new in the async world and it’s a little bit complicate to understand the dynamics…
    Thanks for you support.

    1. @Filippo: Generally speaking, the only real difference between a debug and release version of a project is the configuration file. My guess is you have a bad API key in your release configuration.

  4. I would really appreciate if you could explain how to add members to interests? I have been struggling with adding members to specific interests in lists via api in C#. please provide some example

  5. When I’m adding new member I am able to save with the member’s first name, last name and email on mailchimp. Can you tell how to save member’s address?

    1. Hi @Carl, if you mean a Member’s physical address (e.g., street, city, state, postal code), those would be stored as merge fields, as MailChimp does not have an address model.

      I talk about this briefly in the YouTube video I created on Member management.

      If you mean email address, well, that’s the ID.

  6. I mean the physical address. I’d use

    Dim member As New MailChimp.Net.Models.Member With {
    .EmailAddress = strEmail,
    .StatusIfNew = MailChimp.Net.Models.Status,
    .MergeFields = Dictionary(of String, Object) From { {"FNAME", strFirstName}, {"LNAME", strLastName}, { "ADDRESS", contact }  } } 

    where contact is a MailChimp.Net.Models.Contact.

    await chimpManager.Members.AddOrUpdateAsync(chimpListId, newMember);

    I’m getting Invalid Resource. Status:400, Errors: merge_fields.ADDRESS Data did not match any of the schemas described in anyOf.

    Without the { “ADDRESS”, contact } in the code all is good and the member is being adding to the mailchimp account. I also tried
    {“ADDRESS”, New Object() {contact.Address1, contact.Address2, contact.City, contact.State, contact.Zip, contact.Country} but I’m getting the same error. Which part is incorrect or what is the mistake in the code? Can you point me to the right direction.

  7. Hey Doug!

    I’ve followed this, but perhaps I’m missing something. This is still not adding the address:

    MailChimp.Net.Models.Contact contact = new MailChimp.Net.Models.Contact()
            Address1 = model.Address.Address1,
            Address2 = model.Address.Address2,
            City = model.Address.City,
            State = model.Address.State,
            Zip = model.Address.Zip,
            Phone = model.Phone
    string addressOut = JsonConvert.SerializeObject(contact);
    var member = new MailChimp.Net.Models.Member
            EmailAddress = model.Email,
            EmailType = "html",
            StatusIfNew = MailChimp.Net.Models.Status.Subscribed,
            Status = MailChimp.Net.Models.Status.Subscribed,
            IpSignup = Request.UserHostAddress,
            TimestampSignup = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss"),
            MergeFields = new Dictionary<string, object>
              { "FNAME", model.FName },
              { "LNAME", model.LName },
              { "ADDRESS", addressOut }

Leave a Reply to Rohit Jain Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Check out the Commenting Guidelines before commenting, please!
  • Want to share code? Please put it into a GitHub Gist, CodePen or pastebin and link to that in your comment.
  • Just have a line or two of markup? Wrap them in an appropriate SyntaxHighlighter Evolved shortcode for your programming language, please!