//Generic method for all column types
        private static CSOMOperation AddField(this CSOMOperation operation, string name, FieldType type, string displayName = "", bool required = false, bool uniqueValues = false, string defaultValue = "", string group = "", int?maxLength = null, bool percentage = false, int decimals = 2, int?min = null, int?max = null, List <string> choices = null, ChoiceTypes choiceType = ChoiceTypes.Default, string lookupList = "", string lookupField = "")
        {
            operation.LogInfo($"Adding column {name}");

            FieldCreationInformation fieldInformation = new FieldCreationInformation
            {
                InternalName = name,
                DisplayName  = String.IsNullOrEmpty(displayName) ? name : displayName,
                FieldType    = type,
                Required     = required,
                UniqueValues = uniqueValues,
                Group        = group,
                Default      = defaultValue,
                Percentage   = percentage,
                Decimals     = decimals,
                Min          = min,
                Max          = max,
                Choices      = choices,
                Format       = choiceType,
                List         = lookupList,
                ShowField    = lookupField,
                MaxLegth     = maxLength
            };

            DecideFieldSource(operation).AddFieldAsXml(fieldInformation.ToXml(), true, AddFieldOptions.AddFieldInternalNameHint);

            return(operation);
        }
 public static CSOMOperation AddChoiceField(this CSOMOperation operation, string name, List <string> choices, ChoiceTypes choiceType, string displayName = "", bool required = false, bool uniqueValues = false, string defaultValue = "", string group = "")
 {
     return(operation.AddField(name, FieldType.Choice, displayName, required, uniqueValues, defaultValue, group, choices: choices, choiceType: choiceType));
 }