当前位置: 首页>>代码示例>>C#>>正文


C# Term.CreateTerm方法代码示例

本文整理汇总了C#中Term.CreateTerm方法的典型用法代码示例。如果您正苦于以下问题:C# Term.CreateTerm方法的具体用法?C# Term.CreateTerm怎么用?C# Term.CreateTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Term的用法示例。


在下文中一共展示了Term.CreateTerm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTerm

        public static Term CreateTerm(this SPSite site, Term term, string name)
        {
            if (term.Terms.All(x => x.Name != name))
            {
                var returnterm = term.CreateTerm(name, int.Parse(site.RootWeb.Language.ToString()));
                returnterm.TermStore.CommitAll();
                return returnterm;
            }

            return term.Terms.FirstOrDefault(x => x.Name == name);
        }
开发者ID:814042432,项目名称:DocManagement,代码行数:11,代码来源:TaxonomyHelper.cs

示例2: CustomArea

 private static void CustomArea(CustomAreaOfLaw aol, Term AOLTerm)
 {
     foreach (CustomSubAreaOfLaw asol in aol.Saol)
     {
         Console.WriteLine("\t\tCreating sub area of law " + asol.name);
         Term ASOLTerm = AOLTerm.CreateTerm(asol.name, 1033, Guid.NewGuid());
         if (asol.properties.ContainsKey("SAOLFolders") && !string.IsNullOrWhiteSpace(asol.properties["SAOLFolders"]))
         {
             ASOLTerm.SetCustomProperty("FolderNames", asol.properties["SAOLFolders"]);
         }
         if (asol.properties.ContainsKey("SAOLContentType") && !string.IsNullOrWhiteSpace(asol.properties["SAOLContentType"]))
         {
             ASOLTerm.SetCustomProperty("ContentTypeName", asol.properties["SAOLContentType"]);
         }
         if (asol.properties.ContainsKey("SAOLDocumentTemplate") && !string.IsNullOrWhiteSpace(asol.properties["SAOLDocumentTemplate"]))
         {
             ASOLTerm.SetCustomProperty("DocumentTemplates", asol.properties["SAOLDocumentTemplate"]);
         }
         if (asol.properties.ContainsKey("SAOLIsFolder") && !string.IsNullOrWhiteSpace(asol.properties["SAOLIsFolder"]))
         {
             ASOLTerm.SetCustomProperty("isNoFolderStructurePresent", asol.properties["SAOLIsFolder"]);
         }
     }
 }
开发者ID:RMSATS,项目名称:mattercenter,代码行数:24,代码来源:CreateTerm.cs

示例3: CreateTerm

        public static Term CreateTerm(Term term, Guid termGuid, string nameString, int LCID)
        {
            term.RequireNotNull("term");
            nameString.RequireNotNullOrEmpty("nameString");

            Term newTerm = null;
            if (!Guid.Empty.Equals(termGuid))
            {
                newTerm = term.CreateTerm(nameString, LCID, termGuid);
            }
            else
            {
                newTerm = term.CreateTerm(nameString, LCID);
            }
            return newTerm;
        }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:16,代码来源:SharePointUtilities.cs

示例4: ProcessSubTerms

        private void ProcessSubTerms(ClientContext sourceClientContext, ClientContext targetClientContext, TermSet targetTermSet, Term targetTerm, Term sourceTerm, List<int> languagesToProcess, int defaultLanguage)
        {
            TermCollection sourceTerms = sourceTerm.Terms;
            sourceClientContext.Load(sourceTerms, terms => terms.Include(
                                                              term => term.Name,
                                                              term => term.Description,
                                                              term => term.Id,
                                                              term => term.IsDeprecated,
                                                              term => term.IsAvailableForTagging,
                                                              term => term.LocalCustomProperties,
                                                              term => term.CustomProperties,
                                                              term => term.Labels.Include(label => label.Value, label => label.Language, label => label.IsDefaultForLanguage),
                                                              term => term.TermSet, termset => termset.Id));
            sourceClientContext.ExecuteQuery();
            foreach (Term subSourceTerm in sourceTerm.Terms)
            {
                Term reusedTerm = targetTerm.TermStore.GetTerm(subSourceTerm.Id);
                targetClientContext.Load(reusedTerm);
                targetClientContext.ExecuteQuery();

                Term childTargetTerm;
                if (reusedTerm.ServerObjectIsNull.Value)
                {

                    childTargetTerm = targetTerm.CreateTerm(subSourceTerm.Name, defaultLanguage, subSourceTerm.Id);
                    targetClientContext.Load(childTargetTerm, term => term.IsDeprecated,
                                                              term => term.CustomProperties,
                                                              term => term.LocalCustomProperties);
                    targetClientContext.ExecuteQuery();
                    UpdateTerm(sourceClientContext, targetClientContext, subSourceTerm, childTargetTerm, languagesToProcess);
                }
                else
                {
                    childTargetTerm = targetTerm.ReuseTerm(reusedTerm, false);
                }

                targetClientContext.Load(childTargetTerm);
                targetClientContext.ExecuteQuery();

                targetTermSet.TermStore.UpdateCache();

                ProcessSubTerms(sourceClientContext, targetClientContext, targetTermSet, childTargetTerm, subSourceTerm, languagesToProcess, defaultLanguage);
            }
        }
开发者ID:AaronSaikovski,项目名称:PnP,代码行数:44,代码来源:MMSSyncManager.cs

示例5: CreateChildTerm

 private static void CreateChildTerm(Term parent, TermInit child)
 {
     Term newTerm = parent.CreateTerm(child.TermName, 1033, child.TermID);
       if (child.ChildTerms != null) {
     foreach (TermInit childterm in child.ChildTerms) {
       CreateChildTerm(newTerm, childterm);
     }
       }
 }
开发者ID:CriticalPathTraining,项目名称:GOA365,代码行数:9,代码来源:WingtipContentGenerator.cs

示例6: RecursiveTermCreation

        private static void RecursiveTermCreation(IEnumerable<XElement> descendants, Term term, bool copyId, int LCID)
        {
            foreach (XElement xTerm in descendants)
              {
            Term __childTerm;
            if (copyId)
            {
              __childTerm = term.CreateTerm(xTerm.Attribute("name").Value, LCID, new Guid(xTerm.Attribute("id").Value));
            }
            else
            {
              __childTerm = term.CreateTerm(xTerm.Attribute("name").Value, LCID);
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Importing TermSet [" + __childTerm.Name + "]");

            foreach (XElement label in xTerm.Elements("Label"))
            {
              if ((!label.Attribute("name").Value.Equals(__childTerm.Name)))
              __childTerm.CreateLabel(label.Attribute("name").Value, Convert.ToInt32(label.Attribute("language").Value), Convert.ToBoolean(label.Attribute("isdefault").Value));
            }

            if (xTerm.Elements("Term").Count() > 0)
              RecursiveTermCreation(xTerm.Elements("Term"), __childTerm, copyId, LCID);

              }
        }
开发者ID:cntmnl,项目名称:DEV-GIT,代码行数:28,代码来源:Xmlimport.cs

示例7: ImportTerm

        public void ImportTerm(Term parentTerm, XElement termElement, bool recurse = true)
        {
            try
            {

                //Get the LCID.
                //TODO: Support importing LCIDs
                int lcid = CultureInfo.CurrentCulture.LCID;

                //Get the term name
                string termName = (string)termElement.Attribute("Name");

                //Check if the term exist
                Term term = parentTerm.GetTerms(termName, lcid, true, StringMatchOption.ExactMatch, 1, false).FirstOrDefault();

                //If the term does not exist, create it
                if (term == null)
                {
                    term = parentTerm.CreateTerm(termName, lcid);
                }

                //Create the child terms
                if (recurse)
                {
                    foreach (XElement childElement in termElement.Elements())
                    {
                        ImportTerm(term, childElement, recurse);
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
开发者ID:ashwnacharya,项目名称:SPMetadataManager,代码行数:34,代码来源:Importer.cs

示例8: ProcessTerms

        private static void ProcessTerms(XmlNode termSetTerms, TermSet termSet, Term currentTerm)
        {
            Term newTerm;

            foreach (XmlNode termsNames in termSetTerms.SelectNodes("Term"))
            {
                string strTermName = termsNames.Attributes["Name"].Value;
                if (currentTerm != null)
                {
                    newTerm = currentTerm.CreateTerm(strTermName, termStore.DefaultLanguage);
                }
                else
                {
                    newTerm = termSet.CreateTerm(strTermName, termStore.DefaultLanguage);
                    // termStore.CommitAll();
                }

                termStore.CommitAll();

                Console.WriteLine(strTermName);
                //ProcessLabels
                foreach (XmlNode labelNames in termsNames.SelectSingleNode("Labels").ChildNodes)
                {
                    string strLCID = labelNames.Attributes["lcid"].Value;
                    string strLabelName = labelNames.Attributes["Name"].Value;
                    string strTermDescription = labelNames.Attributes["Description"].Value;
                    if (Convert.ToInt32(strLCID) != termStore.DefaultLanguage)
                    {
                        newTerm.CreateLabel(strLabelName, Convert.ToInt32(strLCID), true);
                        termStore.CommitAll();
                    }
                    newTerm.SetDescription(strTermDescription, Convert.ToInt32(strLCID));
                    termStore.CommitAll();

                    Console.WriteLine(strLCID);
                    Console.WriteLine(strLabelName);
                }
                foreach (XmlNode subTerms in termsNames.SelectNodes("Terms"))
                {
                    ProcessTerms(subTerms, termSet, newTerm);
                }
            }
        }
开发者ID:chrisdee,项目名称:Solutions,代码行数:43,代码来源:Form1.cs


注:本文中的Term.CreateTerm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。