4

We have a category called ProductType with keywords to denote each type and we have a metadata schema called Product Group Metadata associated for each keyword. This metadata schema has three fields. 2 text fields and 1 drop down field.

I've tried using the following:

var keywordMeta = keyword.KeywordMeta;
if (keywordMeta != null)
{
    var metaNameDictionary = keywordMeta.NameValues;
    var metaNameEnumerator = metaNameDictionary.GetEnumerator();

    while (metaNameEnumerator.MoveNext())
    {
        var currentMetaDe = (DictionaryEntry)metaNameEnumerator.Current;
        var currentMeta = (NameValuePair)currentMetaDe.Value;
        if (currentMeta != null)
        {
            // Process each metadata field.
        }
    }
}

Unfortunately, the keyword.KeywordMeta returns 0 despite having a metadata associated with the keyword and the loop is skipped.

Any ideas?

3
  • 1
    Are you sure you are publishing it to database? Commented Jan 19, 2015 at 13:21
  • Oops! I've republished the categories in Tridion and it all seems to work now. My bad!
    – Tim Alonso
    Commented Jan 19, 2015 at 13:26
  • 1
    Could you add that information as an answer? That way, someone else might be helped in the future :) Commented Jan 19, 2015 at 13:46

1 Answer 1

4

The reason why the KeywordMeta property returns 0 is because the changes have not been republished in Tridion. Once you republish the categories, it should return the metadata you're looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.