Chopped Column Names in Sharepoint
While working on a Sharepoint customization project, there were many areas where I needed to create custom site columns. Not thinking much about limits or restrictions I named the columns so that they were meaningful for me and others who may be supporting the site down the road. In a couple of pages I needed to run a query that would pull back information from the custom column (which I added to some custom lists). The custom column was named LFI CAD Possible Answers. When I tried to run the query by substituting in the _x0020_ for spaces, the query would not run.
Well one of my co-workers had written a utility for browsing the Sharepoint object model and getting back various things such as lists, GUIDs, column names, and most importantly the internal name for lists and columns. So although you name a custom column one thing, internally Sharepoint names it something else. For the most part this naming follows what you named the column except that spaces are replaced with _x0020_. Another limitation of the internal name is that it can only be 32 characters long. So if I take my custom column name and add the _x0020_ to the spaces we have: LFI_x0020_CAD_x0020_Possible_x0020_Answers. So take the first 32 characters of that name and you get: LFI_x0020_CAD_x0020_Possible_x00. This was the internal name for that column. The minute I adjusted my query to use that as the name of the field, the query ran fine.
Another side point to the column name and internal column name. We had created a custom column called E-mail. Well the internal name for this column becomes Email without the hyphen. The hyphen is just dropped completely from the column name. So be aware of these limitations when creating custom columns.
Labels: _x0020_, custom column limitations, custom columns, custom site columns, MOSS, Sharepoint 2007
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home