HOME ABOUT
I AM HERE
  • Twitter icon
  • Facebook icon
  • Technorati icon
Bookmark and Share

Space in column names

January 22, 2008 13:50 by aidan

When referencing columns programatically or in CAML that have a space in the name replace the spaces with _x0020_

For example "End Use" becomes "End_x0020_Use"

The format required to access non-alphanumeric column titles is this (IN LOWER CASE):

_x00[the hex code]_

Here are a few more examples:

Char         Code 

[space]      20      i.e. _x0020_
<            3C      i.e. _x003c_
>            3E
#            23
%            25
{            7B
}            7D
|            7C
\            5C
^            5E
~            7E
[            5B
]            5D
`            60
;            3B
/            2F
?            3F
:            3A
@            40
=            3D
&            26
$            24

To reference a column called “e-mail” you would need e_x002d_mail.

This page has a list of all the Hex Codes of some other symbols:http://www.asciitable.com/
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (6) | Comment RSSRSS comment feed

Comments

January 22. 2008 14:26

http://www.sharepointblogs.com/rohan/archive/2007/09/07/spfield-column-field-name-title-and-internal-names-and-spaces-between-them.aspx

bazztrap

January 22. 2008 14:56

And replace ! in names with _x0021_
And replace " in names with _x0022_
...

Or more generic use XmlConvert.EncodeName

Per Jakobsen

January 23. 2008 10:16

Actually, all the better to create the column without a space in the name, and then add the space after. The underlying name is always the initial one.

Donal

January 23. 2008 11:00

Thanks for all the comments! Donal - definitely agree with what you are saying but this is not always possible when dealing with site columns created by users who are not always thinking in a devleoper friendly way. :-)

Aidan

September 9. 2008 19:21

http://www.sharepointblogs.com/rohan/archive/2007/09/07/spfield-column-field-name-title-and-internal-names-and-spaces-between-them.aspx

bazztrap

April 21. 2009 06:49

its a real pain to do it that way

super hacker

Add comment




  Country flag


  • Comment
  • Preview
Loading