Aidan Garnish
MOSS 2007 and other Microsoft technologies

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/

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (4) | Comment RSSRSS comment feed

Related posts

Comments

January 22. 2008 14:26

www.sharepointblogs.com/.../...s-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. Smile

Aidan

Add comment


 

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

November 22. 2008 08:07