public Term FindTerm(TermSet termSet, Guid termGuid, string nameString)
 {
     termSet.RequireNotNull("termSet");
     nameString.RequireNotNullOrEmpty("nameString");
     Term term = FindTerm(termSet, termGuid) ?? FindTerm(termSet, nameString);
     return term;
 }
 public static Term FindTerm(TermSet termSet, Guid termGuid, string nameString)
 {
     termSet.RequireNotNull("termSet");
     nameString.RequireNotNullOrEmpty("nameString");
     Term term = termSet.Terms.FirstOrDefault(t => t.Id.Equals(termGuid) || t.Name.Equals(nameString));
     return term;
 }
 public static Term CreateTerm(TermSet termSet, Guid termGuid, string nameString, int LCID)
 {
     termSet.RequireNotNull("termSet");
     nameString.RequireNotNullOrEmpty("nameString");
     Term newTerm = null;
     if (!Guid.Empty.Equals(termGuid))
     {
         newTerm = termSet.CreateTerm(nameString, LCID, termGuid);
     }
     else
     {
         newTerm = termSet.CreateTerm(nameString, LCID);
     }
     return newTerm;
 }
        public static TaxonomyField CreateMangedMetadataSiteColumn(SPWeb web, string fieldName, TermSet termSet, string GroupName)
        {
            web.RequireNotNull("web");
            fieldName.RequireNotNullOrEmpty("fieldName");
            termSet.RequireNotNull("termSet");

            if (web.Fields.ContainsField(fieldName))
            {
                return web.Fields[fieldName] as TaxonomyField;
            }

            TaxonomyField field = web.Fields.CreateNewField("TaxonomyFieldType", fieldName) as TaxonomyField;
            field.SspId = termSet.TermStore.Id;
            field.TermSetId = termSet.Id;
            field.TargetTemplate = string.Empty;
            ///field.AllowMultipleValues = true;
            // field.CreateValuesInEditForm = true;
            field.Open = true;
            field.AnchorId = Guid.Empty;
            field.Group = !string.IsNullOrEmpty(GroupName) ? GroupName : "Managed Metadata";
            web.Fields.Add(field);
            web.Update();
            return web.Fields[fieldName] as TaxonomyField;
        }
 public Term FindTerm(TermSet termSet, string label)
 {
     termSet.RequireNotNull("termSet");
     return termSet.GetTerms(label, false).FirstOrDefault();
 }
 public Term FindTerm(TermSet termSet, Guid termGuid)
 {
     termSet.RequireNotNull("termSet");
     return termSet.GetTerm(termGuid);
 }