Showing posts with label SharePoint List. Show all posts
Showing posts with label SharePoint List. Show all posts

Wednesday, September 7, 2011

Retrieving SharePoint List programatically

Code below gets you the list object

string srListURL = <list url>

SPSite mySite = new SPSite(strListURL);
SPWeb myWeb = mySite.OpenWeb();

try
{

SPList myList = myWeb.GetList(strListURL);

}

catch(Exception)

{

//error handling here

}