I’ve already detailed how to create a new Taxonomy Field in CSOM – here’s the more generic how to create a general field on a list.:
internal static void CreateFields(ClientContext clientContext, List targetList, string xmlDef) { targetList.Fields.AddFieldAsXml(xmlDef, true, AddFieldOptions.AddFieldInternalNameHint); clientContext.ExecuteQuery(); }
And as a bonus, here’s how to set a field to be indexed in the client side object model:
internal static void SetIndex(ClientContext clientContext, List list, string fieldName) { Field f = list.Fields.GetByInternalNameOrTitle(fieldName); clientContext.Load(f); clientContext.ExecuteQuery(); f.Indexed = true; f.Update(); list.Update(); clientContext.ExecuteQuery(); }