Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesTaxonomy - Programmatically adding terms to vocabularyTaxonomy - Programmatically adding terms to vocabulary
Previous
 
Next
New Post
5/8/2015 8:20 AM
 

Quick question. Is it possible to add Terms programmatically to specific Vocabulary using Term.VocabularyId property?

According to DNN API 7.3.3/7.4.0 document VocabularyId is read only property.

The obvious answer to my question is No.

So the question I am really asking is there another controller that lets you programmatically add terms to vocabularies?

Perhaps of the form AddTerm(string termName, int32 vocabularyId) ?

 
New Post
5/8/2015 8:44 AM
 

I suppose the moment I'll whip up some DAL2 solution to insert records into dbo.Taxonomy_Terms table.

 
New Post
10/23/2015 5:08 PM
 
//code to add a custom term to 'Tags' Vocabulary
List terms = new List();
VocabularyController vocabController = new VocabularyController();
var vocabs = vocabController.GetVocabularies();
IQueryable iqVocab = (from t in vocabs where t.Name == "Tags" select t);
if (iqVocab.Count() == 1)
{
Vocabulary vocab = iqVocab.First();
var countdownTerm = (from t in vocab.Terms where t.Name == "MyNewTerm" select t);
if(countdownTerm.Count() == 0)
{
Term countdown = new Term("MyNewTerm", "A custom term added in code", vocab.VocabularyId);
TermController termController = new TermController();
termController.AddTerm(countdown);
}
}
 
New Post
10/23/2015 5:11 PM
 
st terms = new List();
VocabularyController vocabController = new VocabularyController();
var vocabs = vocabController.GetVocabularies();
IQueryable iqVocab = (from t in vocabs where t.Name == "Tags" select t);
if (iqVocab.Count() == 1)
{
Vocabulary vocab = iqVocab.First();
var countdownTerm = (from t in vocab.Terms where t.Name == "MyCustomTerm" select t);
if(countdownTerm.Count() == 0)
{
Term countdown = new Term("MyCustomTerm", "Custom term to add to Tags", vocab.VocabularyId);
TermController termController = new TermController();
termController.AddTerm(countdown);
}
}
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesTaxonomy - Programmatically adding terms to vocabularyTaxonomy - Programmatically adding terms to vocabulary


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out