I need update choice column. Let say my column has values like "A", "B". Now I need to insert their a new value like "C". My following code is not working.
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
var spList = web.Lists[listName];
SPFieldChoice spChoiceField = (SPFieldChoice)spList.Fields[fieldName];
spChoiceField.Choices.Add(value);
spChoiceField.Update();
spList.Update();
web.AllowUnsafeUpdates = false;
return "Field has been updated with new value: " + value;
}
}