0

I want to get an item from TermStore. I have my string something as Menu & Ali. Also, in the previous iteration of my code (which is irrelevant w.r.t the query) I had added item by the using the same string i.e. Menu & Ali. But now when I am trying to fetch it using the below snippet, I am unable to get the term.

Term trm = trm1.Terms.GetByName(parentName);

Though the term name is still the same but these are not matching ("Menu & Ali" || "Menu & Ali"). On analysing this over and over again (using notepad even), I found that the two strings are no longer same. It is basically due to the & present in the string.

Can anyone help me / guide me the way to work this out? Is this related to the lcid (which is 1033 in this case)

1

Have a look at the TaxonomyItem.NormalizeName method

Try changing your code to

Term trm = trm1.Terms.GetByName(TaxonomyItem.NormalizeName(parentName));
  • Thanks!! Though I was using CSOM approach for this, but yeah you pointed me in the right direction. – Amit Sep 18 '14 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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