You are hereBlogs / Niral's blog / Add choices to Sharepoint Multi-Choice Field

Add choices to Sharepoint Multi-Choice Field


Setting field values of a list item in SharePoint is easy.  But when it comes to Multi-Choice fields, the code is a big different.  The following code shows how values can be added to a multi-choice field.

SPFieldMultiChoice choiceField = (SPFieldMultiChoice)myWeb.Fields["choiceFieldName"];
choiceField.Choices.Add("Value");
//Set PushChangesToLists to true if automatic update of List or Content types is required
choiceField.PushChangesToLists = false; 
choiceField.Upate();

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.