Skip to main content
Use coding format for code
Source Link
Pankaj Gaur
  • 15.9k
  • 1
  • 23
  • 57

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 } } } } }
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
} 
} 
} 
} 
} 

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 } } } } }

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
} 
} 
} 
} 
} 
deleted 2 characters in body
Source Link

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 } } } } }

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 } } } } }

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 } } } } }
Source Link

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 } } } } }