Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Groupings and GroupInterests #191

Open
spyguyhi opened this issue Apr 4, 2016 · 0 comments
Open

Groupings and GroupInterests #191

spyguyhi opened this issue Apr 4, 2016 · 0 comments

Comments

@spyguyhi
Copy link

spyguyhi commented Apr 4, 2016

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant