Thursday, May 17, 2012

Managed Metadata and the Ampersand Character

Every tied custom code with Managed Metadata Service and got unexpected results when comparing text against the terms in MMS?

 

Managed Metadata services changes the symbol for ampersand to this () not the default (&) text character that we use while typing in the term, so we need to replace it with string character for the comparison to work.

 

Snapshot of MMS Termset and Terms

 

Code snippet to handle this:

 

if (mmTranslatedTerm.Value.Contains(""))

{

              defaultTerm = mmTranslatedTerm.Value.Replace("", "&");

       }

 

No comments: