ADD SPFieldType.Choice, SPFieldChoice with SPChoiceFormatType.RadioButtons

using Microsoft.SharePoint;
using System.Collections.Specialized;
public void OnActivated(SPFeatureReceiverProperties properties)
    SPWeb web = (SPWeb)properties.Feature.Parent;
    string url = new Uri(web.Url).AbsolutePath;
    SPDocumentLibrary docLib = (SPDocumentLibrary)web.GetListFromUrl(“Shared Documents/Forms/AllItems.aspx”);
    // Create collection with choices.
    StringCollection categories = new StringCollection();
    categories.AddRange(new string [] {“Choice A”, “Choice B”, “Choice C”} );
    // Create new field in the project documents list.
    docLib.Fields.Add(“MyNewField”, SPFieldType.Choice, true, false, categories);
    // Set additional settings of the new field.
    SPFieldChoice fieldChoice = (SPFieldChoice)docLib.Fields[“MyNewField”];
    fieldChoice.DefaultValue = “Choice A”;
    fieldChoice.EditFormat = SPChoiceFormatType.RadioButtons;
    // Save settings.

Comments (2)

  1. Srini says:

    Thank You Sir.

    This post really helped to resolve my issue.



  2. cherry says:

    British reporters are known for doing almost anything to get a Mulberry Bags. But reports that a newspaper secretly listened to telephone messages of murdered schoolgirls and other private citizens have produced Mulberry Handbags and anger.

    On Friday, British police arrested Andy Coulson, former editor of Mulberry Bag Britain's best-selling newspaper, News of Mulberry Outlet the World. The investigation led him to Mulberry UK Sale resign in January as communications director to Prime Minister David Cameron.

    The arrest came in a widening investigation of Mulberry UK telephone hacking. Other accusations include paying police for mulberry shoulder bags information on stories. The Reuters news agency reported that Mr. Coulson was released on Mulberry Bag UK until a date in October.

    Prime Minister Cameron promised Men's Mulberry Bags Friday that a judge will lead a full public inquiry into Women's Mulberry Bags the case after police complete their investigation.

    DAVID CAMERON: "Murder victims, terrorist victims, families who have lost loved ones, sometimes defending our country, that these people could have had their phones hacked into, in order to generate stories for Mulberry Bags  Mulberry Handbags  Mulberry Bag   Mulberry Outlet  Mulberry UK  mulberry bayswater bag  Mulberry Alexa Bag, is simply disgusting."