manoj´ssharepointblog

SharePoint Blog

Ampersands Comparision Issue in a Taxonomy term

2 Comments

There are two types of ampersands that you need to be aware of when playing with SharePoint Taxonomy

Our favorite and most loved

& ASCII Number: 38

And the impostor

& ASCII Number: 65286

When you create a term it replaces the 38 ampersand with a 65286 ampersand.

This then becomes a problem if you want to do a comparison with your original source (spreadsheet, database, etc) as they are no longer the same.

As detailed in Nick’s article, you can use the TaxonomyItem.NormalizeName method to create a “Taxonomy” version of your string for comparison.

Below is the code I used in the SharePoint 2013 Client Component which is a little different from the server code.

string myString = “Current accounts & cards
using (var context = new ClientContext(“http://MyTestSite”))
{
var result = TaxonomyItem.NormalizeName(context, myString);
context.ExecuteQuery();

string normalisedString = result.Value;
}

In Server Object model it is TaxonomyItem.NormalizeName(myString);

Advertisements

2 thoughts on “Ampersands Comparision Issue in a Taxonomy term

  1. Hi,

    How would you go about editing your code to fix this issue? Any help would be greatly appreciated as I’m new to this and I’m not familiar with the code, mainly using the out-of-box solution.

    Thanks,
    Mel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s