Please upgrade your web browser now. Internet Explorer 6 is no longer supported.
Thinking Web Solutions?
We create smart, fun, functional websites that make your web a better place.

Tip for naming columns and lists in SharePoint

When developing against lists, column names with spaces can be rather annoying. Internally SharePoint encodes spaces with the characters '_x0020_'. This isn't the end of the world but is a bit of a pain when writing code that uses the column names. Over the past few months I have found that I got into the habit of always creating columns without the space, and then renaming them.

As an example if I wanted to create a column named 'Account Number' I would first name it 'AccountNumber'. The internal name is set only once and is based on what the column is called when it is created. After the initial creation I can then safely rename the column with the space and still reference it as 'AccountNumber'.

I have developed the same habit for naming lists. With lists I think it is even more important to not have spaces as you end up with urls that look like this: http://site/lists/my%20task%20list/allitems.aspx. This is not particularly nice to look at and may even cause problems for some search engines. This is also makes it hard to read the URL and ends up as a bit of an accessiblity negative.

You can use the exact same technique as described for naming columns.

6 comments for “Tip for naming columns and lists in SharePoint”

  1. Mike Bunyan  6/14/2009

    Any information on reserved names for columns? Like 'title'.

  2. Zac Smith  6/14/2009

    Hi Mike You can always change the display name of reserved columns to whatever you like. You can also hide the title column all together. If you do this it will make it hard to access the list items as the title column has the link menu attached to it. To get around this just make sure the 'Edit' column is selected in your views so users can still access list items. Unfortunatly there is no way to move the link menu to another column.

  3. Brad Saide  6/14/2009

    You could use SharePoint manager to "Create" columns using reserved words... although you'd want a solid business case to go forward with it, and a replica of production to test in (of course, we all have one of those - it's our dev environment). The mechanism preventing you creating these columns is just JaveScript or C# - but the API does support it.

  4. Stan Bally  6/14/2009

    I have to agree that URL's like this - http://site/lists/my%20task%20list/allitems.aspx. are awful. Google will be ignoring you for things like these. Thank you for article.

  5. Greg Osimowicz  11/24/2010

    This is a good tip - something I always do as well. If only my site owners could be bothered to follow the procedure as well. Instead, I routinely go through new libraries or lists and change URLs in SPD. Not so easy with column names though :(

  6. Eli Manning Jersey  2/14/2012

    http://www.officialpatriotsonline.com/benjarvus-greenellis-jersey There is something

Post a comment