Format for how to define rules for a segment (createsend_dotnet)

I am able to successfully create a list and add subscribers with the createsend_dotnet wrapper.  I am stuck on how to format the rules when creating a segment for a list.

I see the function that I need to use, but I don't know how to format the Segment Rules part

Segment.Create (List ID, "Segment Title", Segment Rules);

If I have a custom field called region and I want to create a segment for subscribers in the north region how do I finish the function

Segment.Create (myListID, "North Segment", ????);
Ken Ken, 4 years ago


You'll need to create and populate a SegmentRules object. See in createsend-dotnet\Models\Segment.cs.

Here's an example:

var rules = new SegmentRules()
                new Rule() {
                    Subject = "EmailAddress",
                    Clauses = new List<string>() {
                new Rule() {
                    Subject = "DateSubscribed",
                    Clauses = new List<string>() {
                        "AFTER 2009-01-01",
                        "BEFORE 2010-01-01"

Let me know if you have any problem with it.
rjgonzalez73, 4 years ago


Thanks for the code. This is exactly what I needed.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free