MailChimp.NET icon indicating copy to clipboard operation
MailChimp.NET copied to clipboard

Groupings and GroupInterests

Open spyguyhi opened this issue 8 years ago • 0 comments

I am not sure if I am trying to create a Grouping with GroupInterests correctly. I keep getting a "An exception of type 'System.NullReferenceException' occurred in myproject.DLL but was not handled in user code". Here's a sample of my code:

// Create and populate Groupings for Giving Interests then add to MergeVar
MailChimp.Lists.Grouping givingGroup = new MailChimp.Lists.Grouping();
givingGroup.Name = "GIVING_INTERESTS";
// Interest list is a comman delimited list in the GIVING_INTERESTS field in the SPROC
List<string> groupInterests_GI = row["GIVING_INTERESTS"].ToString().Split(',').ToList<string>();
for (int i = 0; i < groupInterests_GI.Count; i++)
{                               
    MailChimp.Lists.Grouping.GroupInterest interest = new MailChimp.Lists.Grouping.GroupInterest();
    interest.Name = groupInterests_GI[i].ToString();
    interest.Interested = true;
    givingGroup.GroupInterests.Add(interest);
}

what am I doing wrong?

spyguyhi avatar Apr 04 '16 23:04 spyguyhi