Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7506061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:08:01+00:00 2026-05-29T22:08:01+00:00

I am programatically creating a sharepoint 2010 site in a web method. When the

  • 0

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.

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.

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.

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();

I also include this field in the default view.

SPView defaultView = newList.DefaultView;
defaultView.ViewFields.Add(newList.Fields.GetField(Constants.FIELD_TRANSMITTAL_STATUS));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:08:03+00:00Added an answer on May 29, 2026 at 10:08 pm

    Try to update the list before you call the update method of the field

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am progamatically creating a SharePoint site using SPWeb spWeb = spSite.AllWebs.Add(...); What code
I tried creating Radio Buttons using this example Creating a Cocoa radio button programatically
I was wondering if anyone knows of any libraries for programatically creating flash swf
I am creating menus in WPF programatically using vb.net. Can someone show me how
I am creating a diagnostic page for ASP.NET and would like to programatically detect
I'm trying to populate a ComboBox programatically. I am creating ComboBoxItems and would like
I'm creating list items in a SharePoint (MOSS) list programmatically. I've been successful with
I am creating a .NET website, and this is my first time using a
I am programatically creating instance of usercontrol as shown below Dim uc As Control
I'm programatically creating a custom section header for a table that has a width

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.