Skip to main content
2 of 3
deleted 2 characters in body

Fetching metadata from keyword using Content Delivery API in SDL tridion

I am using the below code to fetch metadata from Keywords using Taxonomy API. I am able to retrieve the Keyword names, but not their metadata. Please suggest.

TaxonomyFactory taxonomyFactory = new TaxonomyFactory(); PublicationCriteria pubCr = new PublicationCriteria(41); ItemTypeCriteria isKwd = new ItemTypeCriteria(1024); Criteria[] arrCriteria = {pubCr,isKwd}; Criteria c = new AndCriteria(arrCriteria); Query q = new Query(c); foreach (string uri in q.ExecuteQuery()) { Response.Write("

  • test - " + taxonomyFactory.GetTaxonomyKeyword(uri).KeywordName + " "); Keyword item = taxonomyFactory.GetTaxonomyKeyword(uri); CustomMeta customMeta = item.KeywordMeta; if (customMeta != null) { IDictionary mnd = customMeta.NameValues; IEnumerator mne = mnd.GetEnumerator(); if (mne != null) { while(mne.MoveNext()) { DictionaryEntry de = (DictionaryEntry)mne.Current; NameValuePair currentMeta = (NameValuePair)de.Value; if (currentMeta != null) { Response.Write(currentMeta.Value); // this is actually returning the TCM ID's and not the values } } } } }