SharePoint 2010 – accessing column names with spaces

I’m currently writing a web application which connects to a SharePoint 2010 list and retrieves some data items. When i tried to access some of the existing fields, i realized that column names with spaces are a bit tricky to access, because SharePoint uses internal names for these fields. To keep a long story short: replace the spaces with the following characters:

//if the column was named "My Column"
string value = _item["My_x0020_Column"].ToString();

Advertisements
SharePoint 2010 – accessing column names with spaces

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s