Stumbles and Travels


Adding value to Multi-choice field with Object Model
June 9, 2007, 3:37 pm
Filed under: MOSS

This is a quick post on how to add another value to a Multi-choice field using the object model.  The code is below and assumes that you already have a reference to your SPWeb object stored in ‘myWeb’.

SPFieldMultiChoice myField = (SPFieldMultiChoice)myWeb.Fields["Field Name"];
myField.Choices.Add(“Value to add”);
myField.PushChangesToLists = true; //Set to false if you don’t want Lists/Content types to update automatically
myField.Upate();


1 Comment so far
Leave a comment

This was really helpful

Comment by CH1




Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>