Get Choice Field values using Client Side Object Model in SharePoint 2013



ClientContext context = new ClientContext(source_site_url);
           List list = context.Web.Lists.GetByTitle(list_name);
           Field choice = list.Fields.GetByInternalNameOrTitle("jobtitle");

           FieldChoice fldChoice = context.CastTo<FieldChoice>(choice);
           context.Load(fldChoice, f => f.Choices);
           context.ExecuteQuery();
           Foreach (string item in fldChoice.Choices)
           {
               control_name.Items.Add(item.ToString());
               //add choices to dropdown list
           }

Comments

Popular posts from this blog

WCF interview questions

The term 'Connect-MsolService' is not recognized as the name of a cmdlet, function, script file, or operable program

what is Event Cache table in sharepoint