SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to add and select values to a choice field in a document library. Something obviously more tricky than I remembered.

I'm doing something like this but it doesn't work. The value gets added to the field in list views but not to the Choice column.

ClientContext ctx = new ClientContext("http://mymachine");
Web currentWeb = ctx.Web;

SP.List list = ctx.Web.Lists.GetByTitle("Doclib");

ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());

foreach (ListItem listItem in items)

    if (listItem.File.Name.Equals(fileName))
        var processValue = "A Value";
        listItem["MetaProcess"] = processValue;
        //SP.FieldChoice itemType = ctx.CastTo<SP.FieldChoice>(list.Fields.GetByTitle("MetaProcess"));
        //itemType.Choices = new[] { "Agenda", "Agreement", "Full text", "Minutes", "News Item", "Reference" };
share|improve this question
up vote 0 down vote accepted

Did select to work in another route using the Camelot .NET Connector for SharePoint instead!

share|improve this answer

the following works for me.

    calendarDropDown = (DropDownList)TemplateContainer.FindControl("calendarDropDown");
    if (ControlMode == SPControlMode.New || ControlMode == SPControlMode.Edit)
        SPWeb currentWeb = SPContext.Current.Web;
        SPListCollection lists = currentWeb.Lists;
        foreach (SPList list in lists)
            if (list.BaseTemplate == SPListTemplateType.Events)
share|improve this answer
And this will run in ClientContext? – Eric Herlitz May 7 '12 at 21:25
This is not a code with ClientContext, but with classic server side object model – Steve B Jun 21 '12 at 9:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.