Blog Home  Home |  Breeze Home RSS 2.0 Atom 1.0 CDF  
SCAREY Sharepoint Blog - Getting column values from an item within SharePoint
Shannon - Breeze Training
# Monday, November 23, 2009

One place I often see new developers get stuck when developing with the SharePoint Object Model is trying to get information from a document library or list field

The place they get stuck is they write

string smyField = SPListItem.Fields[“myField”].ToString();

This will return the name of the column/field NOT the value within it

The trick is to write it like this

string smyField = SPListItem[“myField”].ToString();

Monday, November 23, 2009 11:33:11 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]    | 
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview
Copyright © 2010 Breeze Training. All rights reserved.