I'm using the following code to retrieve a list of keywords for a given category Id. I've been looking at the content delivery api documents as reference but my code doesn't work. I've tried adding log statements and found that the code doesn't even get inside the if statement. We're using Tridion 2011 SP1 and an oracle database (if that makes a difference).
private List<string> GetKeywords(string categoryId)
{
// Taxonomy manager
TaxonomyFactory factory = new TaxonomyFactory();
// Get keywords
Keyword cat = factory.GetTaxonomyKeywords(categoryId);
// Check if keywords exist
if (cat.HasChildren)
{
foreach (var keyword in cat.KeywordChildren)
{
keywordsList.Add(keyword.ToString());
}
}
return keywordsList;
}
Can anybody see where I'm going wrong or maybe point me in the right direction?