Retrieve sharepoint list data c#
RETRIEVE SHAREPOINT LIST DATA USING C#(SERVER OBJECT MODEL):
First insert the following name space
using Microsoft.SharePoint;
Use the following code to retrive list data
protected void Page_Load(object sender, EventArgs e)
{
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
SPList listobj = web.Lists["ListName"];
SPQuery qry = new SPQuery();
qry.Query = "<view/>";
SPListItemCollection _icoll = listobj.GetItems(qry);
foreach (SPListItem item in _icoll)
{
Label1.Text += Convert.ToString(item["ColumnName"]);
}
}
If you want to bind it to a GridView then see this GridView simple example Clickable/Databound in GridView
Very informative post...!
ReplyDeleteRETRIEVE SHAREPOINT LIST DATA USING C#(SERVER OBJECT MODEL):
Will definitely try this to retrieve sharepoint list data....
Well, we are here to share our blog - Top 10 Web Development Companies in Florida, USA | Hire Dedicated Developers Florida 2022
Waiting for your future posts...