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

Getting the Grouping ID

Open dorofino opened this issue 10 years ago • 1 comments

Hi ,

On your documentation you mentioned to add your Group ID. This ID is coming from where, MailChimp? if so the GroupID is a string and not a Int.

can some one help me with this, thanks

myMergeVars.Groupings[0].Id = 1234; // replace with your grouping id

dorofino avatar Jul 11 '15 23:07 dorofino

@dorofino here's the code I used to get all grouping information:

            MailChimpManager mc = new MailChimpManager(APIKEY);

            var lists = mc.GetLists().Data;
            foreach (var list in lists)
            {
                var listName = list.Name;
                var listId = list.Id;
                try
                {
                    // When a group has no interest groupings, an exception is thrown
                    var groupings = mc.GetListInterestGroupings(listId);

                    foreach (var grouping in groupings)
                    {
                        var groupingId = grouping.Id;
                        var innerGroups = grouping.GroupNames;
                        foreach (var innerGroup in innerGroups)
                        {
                            var gname = innerGroup.Name;
                            var gbit = innerGroup.Bit;
                        }
                    }
                }
                catch
                { }
            }

AmadeusW avatar Oct 25 '15 06:10 AmadeusW