SharePoint Illegal Characters

Ran into a very frustrating issue tonight, where my Web Part Connections were breaking, with very little logging/diagnostic info returned. In fact, depending on the scenario, the most informative information SharePoint (well, ASP.NET really) gave me was stuff like this…

An error occurred while parsing EntityName. Line x, position y. (X and Y will be different for you).

For me, it was that column names for a list (the list works fine) had an Ampersand in it – you know, one of these &”. Again, it was fine in a column, but broke the crap out of my web part connections.

So, I had a look and it appears use of ANY of these characters, in Column Names, Files, Folders or Site Names is generally a really bad idea, if you want headaches like I just experienced. Here they are:

# % & * { } : ? / + | ” . _

Additional Notes:

  • Period can’t be used consecutively in the middle of a name or at the end
  • Underscore shouldn’t be used at the start of any name
  • Spaces are encoded as %20 (3 sharacters) and count to the 240 character Web-DAV file length limit

I should note too, that the only reason I even got some useful information to come to this conclusion, was because I had turned on more informative (less user friendly) debugging in my applications web.config file. I blogged about that, earlier tonight (http://brainlitter.com/archives/2008/09/sharepoint-debu.htm), as all I was getting was useless “An unexpected error has occurred” messages.