Already struggling with the poor functionality of the web service interface of the Taxonomy web service of SharePoint 2010, I stumbled upon another challenge.
I was building a MS CRM 2011 Plugin that populates the SharePoint Term Store using the Taxonomy web service (http://<sharepointurl>/_vti_bin/TaxonomyClientService.asmx).
The first problem was the poor functionality of the web service like being unable to add Labels to Terms.
This cannot be fixed worked around.
Then I had to query SharePoint for a Term that contained an ampersand.
Adding the Term was not a problem when the XML was escaped properly.
string _newterm = “V&D”;
_newterm = _newterm.Replace(“&”, “&”).Replace(“<“, “<”).Replace(“>”, “>”).Replace(“\””, “"”).Replace(“‘”, “'”);
But when the SharePoint is queried for a certain Term… it works slightly different.
The TermStore can be queried for example using “GetTermsByLable()”
string TermXml = SPTaxService.GetTermsByLabel(TermLabel,
1033,
StringMatchOption.ExactMatch,
10,
NewTermXml,
false);
When you send use the TaxonomyClientService.asmx, the service will not find your term, even though when you created it you used the exact same string.
The reason is that an & will be stored by SharePoint as \uFF06
So when you wanna search for a Term, make sure you replace the ampersand… like…
string XmlTerm = “<newTerms><newTerm label=\”” + _newterm.Replace(“&”, “\uFF06”) + “\” clientId=\”1\” parentTermId=\”” + Guid.Empty + “\”></newTerm></newTerms>”);
The weird thing is, that the VS2010 Debugger still will show you the &
The result from SharePoint is the right one…
So …replacing the & with & does not work..!
I was suggested this blog via my cousin. I’m not certain whether or not this put up is written via him as no one else realize such distinctive about my problem. You are amazing! Thanks!
Hi there, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments?
If so how do you reduce it, any plugin or anything you can advise?
I get so much lately it’s driving me insane so any help is very much appreciated.
My blog is hosted by WordPress… I think WP blocks pretty much everything that is SPAM.
Good luck with your spam-issue.
IvoB