Closed VerdonTrigance closed 5 years ago
Hello @VerdonTrigance ,
Term nesting is fully supported for both CSOM/SSOM, and it works exactly as you showed - by nesting . AddTaxonomyTerm() one under the other.
A few examples can be found in the regression test, here is how it works for both CSOM/SSOM:
If that isn't what you are after, let us know what the exact problem and target scenario would be.
@SubPointSupport thank you for reply and example. It usage quite strange. How to add term6 under term4 in that example? There is no second argument in function.
@VerdonTrigance no worries.
.AddTaxonomyTerm() is an extenion method under "SPMeta2.Standard.Syntax" namespace.
It just might be that VS or VSCode does not see this method. ReSharper or latest VisualStudio automatically resolves namespaces making sure that extension methods are available.
Here is the method definition:
Give it a try by adding "using SPMeta2.Standard.Syntax;", check if the method is available. Adding terms under terms is a matter of constructing the object tree. SPMeta2 provides an API to craft such an object tree.
Let's use doco example you shared early:
What you want to do is most likely looks like this:
using SPMeta2.Standard.Syntax;
...
...
var model = SPMeta2Model.NewSiteModel(site =>
{
site.AddTaxonomyTermStore(defaultSiteTermStore, termStore =>
{
termStore.AddTaxonomyTermGroup(clientsGroup, group =>
{
group
.AddTaxonomyTermSet(smallBusiness, termSet =>
{
termSet.AddTaxonomyTerm(subPointSolutions);
})
.AddTaxonomyTermSet(mediumBusiness)
.AddTaxonomyTermSet(enterpriseBusiness, termSet =>
{
termSet
.AddTaxonomyTerm(microsoft, msTermNode => {
// msTermNode <- this is actual "microsoft" term added early
// let's add apple term under microsoft term
// we use extension method resolving model tree node, moving down
msTermNode.AddTaxonomyTerm(apple, appleTermNode => {
// appleTermNode <- this is actual "apple" term added under "microsoft" term
// same-same, extention method, one level down
appleTermNode.AddTaxonomyTerm(oracle);
});
})
.AddTaxonomyTerm(apple)
.AddTaxonomyTerm(oracle);
});
});
});
});
Hope that helps. If not - just share the term tree - how you'd like it to see, we'll translate into SPMeta2 model for you.
Thank you. I will check what namespace I was using tomorrow and post a feedback. I wanted such structure under termset Shops: country - region - city - shop1, shop2, so on. PS: sorry, I’m typing from the phone.
Then it should work well. Give it a go, let us know how it goes.
Hi. I have checked this and it is working as u sayed. I can’t tell what namespace I used before, but anyway now it works as expected. Thank you
Hello, guys. Is it possible to provision TaxonomyTermDefinition with child TaxonomyTermDefinition through StandardSSOMProvisionService for example?
I have seen this: http://docs.subpointsolutions.com/spmeta2/reference/sp-standard-definitions/taxonomytermdefinition.html but there is no child terms in other terms.
Like this: