Thursday, October 27, 2011

Get value of Choice Field from SharePoint List

Leave a Comment

Scenario:  Get value from Choice Field of SharePoint list in windows console application

SPSite site = new SPSite("Full qualified Site Url”);
SPWeb web = site.OpenWeb();
SPList list = web.Lists["ListName"];

// Here it is assumed that you know item id. But you can use SPQuery object to get specific item from SharePoint list.
SPListItem item = list.GetItemById(1);

string value = item.GetFormattedValue("MyColumn");

Console.WriteLine(value);

0 comments: