I have a couple of custom classifications for images, so, for example:
Colors - white, beige, cherry, brown, black
Product Lines - Product Line 1, Product Line 2, Product Line 3, Product Line 4
And I have an album:
Img1 - beige, product line 1
Img2 - white, product line 1
Img3 - brown, product line 2
When I load this album into a custom control, I want to populate two drop-downs with the taxonomies, but I want to get only the taxa that have images in this album, so only beige, white, brown, and product lines 1 and 2 should appear in the drop-downs.
Is there something in the Sitefinity API that could accomplish this? I didn't see anything with a quick search, but I was hoping for a clean way of doing this.
If it helps, we're using Sitefinity 8.0.
var taxonomyManager = TaxonomyManager.GetManager();
var tagTaxonomy = taxonomyManager.GetTaxonomies<FlatTaxonomy>().SingleOrDefault(s => s.Name ==
var statistics = taxonomyManager.GetStatistics().Where(
t.TaxonomyId == tagTaxonomy.Id &&
t.MarkedItemsCount > 0 &&
t.StatisticType == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
var taxonId = item.TaxonId;
Thanks for the help! I had a feeling the solution was going to require looking at each individual image, but I figured I would at least see if someone knew of something better. Still, this will work nicely.