Help with Taxonomy API. Retrieving all values from Flat Taxa
Hi,
Does anyone know where this is full documentation for the taxononomy api
within Sitefinity. I have read everything available online I can find and have
found that it is not sufficient and doesn't solve my problems.
I am trying to retrieve all the values from a custom Flat classification
(Taxonomy) I created called "Countries", of singular "Country". These
will populate a drop down and be used with a module to display data
based on the country, however I don't know how to retrieve the actual
values of all the countries.
I have attempted to used the following select all my countries which doesn't work:
var taxa = manager.GetTaxa<FlatTaxon>().Where(t => t.Name == "Country").ToList();
At present i am resigned to looking in the database at tables and stored
procedures trying to work out how to achieve this as there isn't
sufficient documentation on the Taxonomies API. Can anyone help with
this as I need it today?
Cheers
Hi Paul,
this is (a stripped) part of the code i use to retrieve my custom Flat classification:
TaxonomyManager taxManager = TaxonomyManager.GetManager();
var tags = taxManager.GetTaxonomies<
FlatTaxonomy
>().Where(t => t.Name.ToLower() == "countries").SingleOrDefault();
if (tags != null)
var orderedTags = tags.Taxa.OrderBy(t => t.Name);
foreach (var tag in orderedTags)
Thanks for that, worked perfectly!
Created a list of tag.Title.value to get the actual values I required
Perfect.