To get the choices on a Choice field programmatically …

… you can use the code below:

SPSite sc = new SPSite("http://portal");
SPWeb rootWeb = sc.RootWeb;
SPField state = rootWeb.Fields["State"];
XmlDocument doc = new XmlDocument();
doc.LoadXml(durum.SchemaXml);
foreach (XmlNode choice in doc.SelectNodes("//CHOICE"))
    Console.WriteLine(choice.InnerText);
sc.Close();

Leave a Reply