public string AddNewField(string displayName, string fieldType, bool required) { SPFieldType ft; if (fieldType.TryParseEnum(true, out ft) == false) { SPFieldInstance.ThrowUnknownFieldTypeException(this.Engine); } return(m_fieldCollection.Add(displayName, ft, required)); }
public string AddNewField(string displayName, string fieldType, bool required, bool compactName, ArrayInstance choices) { if (choices == null) { throw new JavaScriptException(this.Engine, "Error", "The choices argument must be specified."); } SPFieldType ft; if (fieldType.TryParseEnum(true, out ft) == false) { SPFieldInstance.ThrowUnknownFieldTypeException(this.Engine); } var strChoices = new StringCollection(); foreach (var c in choices.ElementValues) { strChoices.Add(TypeConverter.ToString(c)); } return(m_fieldCollection.Add(displayName, ft, required, compactName, strChoices)); }