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


C# TermStore.GetGroup方法代码示例

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


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

示例1: AddGroup

        private static TermGroup AddGroup(ClientContext clientContext, TermStore termStore)
        {
            var groupId = new Guid("8de44223-5a8f-41cd-b0e2-5634b0bb953b");
            var termGroup = termStore.GetGroup(groupId);
            clientContext.Load(termGroup);
            clientContext.ExecuteQuery();

            if (termGroup.ServerObjectIsNull.Value)
            {
                termGroup = termStore.CreateGroup("Taxonomy Navigation", groupId);
                clientContext.Load(termGroup);
                clientContext.ExecuteQuery();
            }

            return termGroup;
        }
开发者ID:modulexcite,项目名称:TrainingContent,代码行数:16,代码来源:TaxonomyHelper.cs

示例2: LookupTerm

        public static Term LookupTerm(SPSite site, TermStore tesmStore, TaxonomyFieldDefinition taxFieldModel)
        {
            Group currentGroup = null;

            var termGroupName = taxFieldModel.TermGroupName;
            var groupId = taxFieldModel.TermGroupId;
            var isSiteCollectionGroup = taxFieldModel.IsSiteCollectionGroup;

            if (!string.IsNullOrEmpty(termGroupName))
            {
                currentGroup = tesmStore.Groups.FirstOrDefault(g => g.Name.ToUpper() == termGroupName.ToUpper());
            }
            else if (groupId != null && groupId.HasGuidValue())
            {
                currentGroup = tesmStore.GetGroup(groupId.Value);
            }
            else if (isSiteCollectionGroup.HasValue && isSiteCollectionGroup.Value)
            {
                currentGroup = tesmStore.GetSiteCollectionGroup(site);
            }

            // TODO
            // that should also check if the TermSet is there, so to scope the term 

            if (currentGroup != null)
            {
                if (taxFieldModel.TermId.HasValue)
                    return tesmStore.GetTerm(taxFieldModel.TermId.Value);

                if (!string.IsNullOrEmpty(taxFieldModel.TermName))
                {
                    return tesmStore.GetTerms(taxFieldModel.TermName, taxFieldModel.TermLCID, false)
                                    .FirstOrDefault(t => t.TermSet.Group.Name == currentGroup.Name);
                }
            }
            else
            {
                if (taxFieldModel.TermId.HasValue)
                    return tesmStore.GetTerm(taxFieldModel.TermId.Value);

                if (!string.IsNullOrEmpty(taxFieldModel.TermName))
                    return tesmStore.GetTerms(taxFieldModel.TermName, taxFieldModel.TermLCID, false).FirstOrDefault();
            }

            return null;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:46,代码来源:TaxonomyFieldModelHandler.cs

示例3: LookupTermSet

        public static TermSet LookupTermSet(
            TermStore tesmStore,
            string termGroupName, Guid? groupId, bool? isSiteCollectionGroup, SPSite site,
            string termSetName, Guid? termSetId, int termSetLCID)
        {
            Group currentGroup = null;

            if (!string.IsNullOrEmpty(termGroupName))
            {
                currentGroup = tesmStore.Groups.FirstOrDefault(g => g.Name.ToUpper() == termGroupName.ToUpper());
            }
            else if (groupId != null && groupId.HasGuidValue())
            {
                currentGroup = tesmStore.GetGroup(groupId.Value);
            }
            else if (isSiteCollectionGroup.HasValue && isSiteCollectionGroup.Value)
            {
                currentGroup = tesmStore.GetSiteCollectionGroup(site);
            }

            if (termSetId.HasGuidValue())
            {
                if (currentGroup != null)
                    return currentGroup.TermSets.FirstOrDefault(t => t.Id == termSetId.Value);

                return tesmStore.GetTermSet(termSetId.Value);
            }

            if (!string.IsNullOrEmpty(termSetName))
            {
                if (currentGroup != null)
                    return currentGroup.TermSets.FirstOrDefault(t => t.Name.ToUpper() == termSetName.ToUpper());

                return tesmStore.GetTermSets(termSetName, termSetLCID).FirstOrDefault();
            }

            return null;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:38,代码来源:TaxonomyFieldModelHandler.cs

示例4: DeleteGroupIfExists

        private void DeleteGroupIfExists(TermStore defaultSiteCollectionTermStore, Guid testGroupId)
        {
            Group existingTestGroup = defaultSiteCollectionTermStore.GetGroup(testGroupId);
            if (existingTestGroup != null)
            {
                foreach (var termSet in existingTestGroup.TermSets)
                {
                    termSet.Delete();
                }

                existingTestGroup.Delete();
                defaultSiteCollectionTermStore.CommitAll();
            }
        }
开发者ID:ASAGARG,项目名称:Dynamite,代码行数:14,代码来源:FieldHelperTest.cs


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