Error while deleting category from backend
Hello Emil,
Can you please let us know if the exception occurs when trying to remove a particular category from the backend UI, or it's valid for all classifications? Also, have you done any modification to your project prior to the exception occurring? Just in case, you can try removing it using our API. For example:
TaxonomyManager manager = TaxonomyManager.GetManager();
NewsManager nManager = NewsManager.GetManager();
var myCategoryId = manager.GetTaxa<HierarchicalTaxon>().Where(t => t.Name ==
"MyNewsCategory"
).Single().Id;
//Get a list of the news items who have the desired category assigned to them
var newsList = nManager.GetNewsItems().Where(nI=> nI.GetValue<TrackedList<Guid>>(
"Category"
).Contains(myCategoryId)).ToList();
foreach
(var newsItem
in
newsList)
var catlist = newsItem.GetValue<TrackedList<Guid>>(
"Category"
);
//Remove the categopry fromt he list of categories assigned to the item
catlist.Remove(myCategoryId);
newsItem.SetValue(
"Category"
, catlist);
nManager.SaveChanges();