/// <summary> /// Create one column site of Taxonomy /// </summary> /// <param name="args"></param> private static bool CreateColumnSiteTaxonomy(ParamsCreateSite args, SPFieldType type) { var result = false; var columnSite = new SiteColumn(new ParamsSiteColumnDefaultValue { Web = args.Web, Name = args.Name, FieldType = type, Requiered = args.Requiered, Group = args.Group, AddPrefix = args.AddPrefix, DefaultValue = args.DefaultValue }); if (!columnSite.Exist()) { result = columnSite.CreateTaxonomy(args.GroupTerm, args.Term, args.MultiValue, args.Requiered); } args.Name = (args.AddPrefix) ? string.Concat(Constants.Prefix, args.Name) : args.Name; columnSite.RenameField(args.Name, string.IsNullOrEmpty(args.DisplayName) ? args.Name : args.DisplayName); if (args.Hidden) { columnSite.Hidden(); } return result; }
private static bool CreateColumnSetParameters(ParamsCreateSite args, SiteColumn columnSite) { var result = false; if (!columnSite.Exist()) { result = columnSite.Create(); if (args.Hidden) columnSite.Hidden(); } return result; }