How to get list of fields from a list in dot net c#

I am trying to get all fields from a list in dot net c#. I went through all Sample code for dot net but couldn't find.


rhkiyani, 2 years ago

Including Custom Fields

Phil Phil, 2 years ago

Hi rhkiyani, i just committed a new sample to address this shortfall.

In general, if you can't find what you're looking for in the samples, you have a few different ways to figure out how to do it. The documentation has, for example, all of the "list"-level endpoints that are available in the API (as well as campaigns, subscribers, templates etc).

Each of those endpoints will tend to have a matching method on the List object in the .NET library.

You can then find the one you're looking for by either reading the code or just letting intellisense guide in you Visual Studio.

All the best,

rhkiyani, 2 years ago

Thank you Phil. I can get the list of custom fields now. I am building public face form to list multiple options in asp:checkboxlist or asp:radiobuttonlist . For testing I am just adding it to label.

Here is how I am doing.

var options = field.FieldOptions;
foreach(string s in options)
    lbl_alert_message.Text += "Option: " + s;

Is is right or any better way to do this?


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