Hello Team,
I am trying to do SharePoint hosted APP's ,In that i want to create client side list, in that list i am having one choice column how to do that in client side ,the fallowing is the server side code.
if (!AnnouncementList.Fields.ContainsField("Publish To"))
{
//adding new column PublishTo
String Publishtofield = AnnouncementList.Fields.Add("Publish To", FieldType.Choice, false);
FieldChoice Pubtofield = (FieldChoice)AnnouncementList.Fields.GetFieldByInternalName(Publishtofield);
string[] Publishtypes = { "Groups", "Organization" };
Pubtofield.EditFormat = ChoiceFormatType.RadioButtons;
Pubtofield.Title = "Publish To";
Pubtofield.StaticName = "PublishTo";
Pubtofield.ShowInListSettings = true;
Pubtofield.ShowInDisplayForm = true;
Pubtofield.ShowInEditForm = true;
Pubtofield.ShowInViewForms = true;
Pubtofield.ShowInNewForm = true;
Pubtofield.DefaultValue = "Groups";
Pubtofield.Choices.AddRange(Publishtypes);
Pubtofield.Update();
AnnouncementList.Update();
}
if(!AnnouncementList.Fields.ContainsField("Publish"))
{
//adding new column Publish
string Pubfield = AnnouncementList.Fields.Add(<Field Type='Choice' DisplayName='Publish To'/>);
FieldUser user = new FieldUser(AnnouncementList.Fields, Pubfield);
user.SelectionMode = SPFieldUserSelectionMode.PeopleAndGroups;
user.AllowMultipleValues = true;
user.ShowInListSettings = true;
user.ShowInDisplayForm = true;
user.ShowInEditForm = true;
user.ShowInViewForms = true;
user.ShowInNewForm = true;
user.Update();
AnnouncementList.Update();
}
Normal Field i am added using this,
AnnouncementList.Fields.AddFieldAsXml("<Field Type='DateTime' DisplayName='Publish Date'/>", true, AddFieldOptions.DefaultValue);
Please give any examples or for that client code .
Thank's,
Lakshmi.