Error updating taxonomy data when using the Taxonomy Manger GetItem

  • Updated

When using the framework API GetItem method for the TaxonomyManager you may get an error when trying to update the taxonomy data back into the system. Below is the error and a sample of code that could cause the error.

Ektron.Cms.Framework.Organization.TaxonomyManager tManager = new Ektron.Cms.Framework.Organization.TaxonomyManager();
var tData = tManager.GetItem(taxonomyID);
tData.Description = "updated";
tManager.Update(tData);

Configurations are only for parent taxonomies that are in Level 1.

Using the API this way will not work if you are updating a taxonomy node that isn't in the first level. In order for the code to work, you would need to use the GetTree method instead.

Ektron.Cms.Framework.Organization.TaxonomyManager tManager = new Ektron.Cms.Framework.Organization.TaxonomyManager();
var tData = tManager.GetTree(taxonomyID);
tData.Description = "updated";
tManager.Update(tData);