Here I'm going to show you how you can read the list from share point site.
To do this; First you have to add the reference to Microsoft.Sharepoint.dll (Then you can use "using Microsoft.Sharepoint;" in your code).
To do this; First you have to add the reference to Microsoft.Sharepoint.dll (Then you can use "using Microsoft.Sharepoint;" in your code).
//******Create Data table******void CreateListtable(){dtList = new DataTable();dtList.Columns.Add("List", typeof(string));dtList.Columns.Add("Description", typeof(string));}//******Read the lists******public void GetAllList(){CreateListtable();SPSite site = new SPSite(strUrl);using (SPWeb web = site.OpenWeb()){SPListCollection listcollection = web.Lists;{foreach (SPList listName in listcollection){DataRow dr = dtList.NewRow();dr["List"] = listName;dr["Description"] = listName.Description;dtList.Rows.Add(dr);}}}}
No comments:
Post a Comment