+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Help with Taxonomy API. Retrieving all values from Flat Taxa

Help with Taxonomy API. Retrieving all values from Flat Taxa

4 posts, 1 answered
  1. Paul
    Paul avatar
    28 posts
    Registered:
    17 Jan 2012
    24 Feb 2012
    Link to this post
    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
  2. Matthias
    Matthias avatar
    10 posts
    Registered:
    30 Jul 2009
    24 Feb 2012
    Link to this post
    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) {
        }
    }

    HTH
    Matthias
    Answered
  3. Paul
    Paul avatar
    28 posts
    Registered:
    17 Jan 2012
    27 Feb 2012
    Link to this post
    Thanks for that, worked perfectly!

    Created a list of tag.Title.value to get the actual values I required
  4. Bishoy
    Bishoy avatar
    27 posts
    Registered:
    15 Aug 2013
    03 Feb 2014
    Link to this post
    Perfect.
4 posts, 1 answered