本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}