title: <nativehr>0x80070057</nativehr><nativestack></nativestack> When creating a Choice field in a Sharepoint list
body: <p>I am programatically creating a sharepoint 2010 site in a web method. When the site is created - it fires off a 'feature activated' event receiver. In this event receiver, I am creating lists on the site and adding fields to them.</p>
  
  <p>One of the fields I am creating is a choice field (drop-down list). I add several choice options to this control but find that when the site is created, if I drop down the field there are no options in the list.  I realised, through web research, that I needed to call the update method of my choice field. As soon as I did this, the creation of the site threw an exception with the following description:
      0x80070057 
  Not very helpful.</p>
  
  <p>If I comment out the update method of the choice field the site creates again no problem, but there are no options in the drop-down.</p>
  
  <pre><code>SPFieldChoice fldTransmittalStatus =   
  (SPFieldChoice)newList.Fields.CreateNewField(Microsoft.SharePoint.SPFieldType.Choice.ToString(), Constants.FIELD_TRANSMITTAL_STATUS);
  newList.Fields.Add(fldTransmittalStatus);                  
  fldTransmittalStatus.EditFormat = SPChoiceFormatType.Dropdown;
  fldTransmittalStatus.Choices.Add("Sent");
  fldTransmittalStatus.Choices.Add("Downloaded");
  fldTransmittalStatus.Choices.Add("Received");
  fldTransmittalStatus.Choices.Add("Resent");
  fldTransmittalStatus.Choices.Add("Cancelled");
  fldTransmittalStatus.Update(); // when present, this line causes the site creation to fail
  . . . . 
  . . . . 
  newList.Update();
  </code></pre>
  
  <p>I also include this field in the default view.</p>
  
  <pre><code>SPView defaultView = newList.DefaultView;
  defaultView.ViewFields.Add(newList.Fields.GetField(Constants.FIELD_TRANSMITTAL_STATUS));
  </code></pre>