Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Connection to Sharepoint List by c# code in Sharepoint List of Microsoft sharepoint
2965 Views
To Connect the list
To connect the sharepoint list only few lines of codes needed :-

//To open the Root site
SPSite objSite = new SPSite(SPContext.Current.Site.Url);
//To open the current site(web) 
SPWeb objWeb = objSite.OpenWeb();
//To open list 
SpList list = objWeb.Lists["List_name"];
To Access the list items
Once connected to list ,you can access the items of list.

//Get all the item of list
SpListItemCollection ListItems = list.Items;
//To get particular list item
SpListItem Item = ListItems[0];
//To get the item with title of the column
string ItemColumn = (string) Item["Column_name"];//Must have to cast the field.
Best Lessons of "Microsoft sharepoint"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details