I have list with approx 20000 items, and want to push that into sql table. Can anyone help me with c# code. Thanks

  • 1
    Please share your work. What you have tried so far ? – Bhaskar Dhone Jan 15 '16 at 10:30

A simple solution will be to export the SharePoint list in excel and then import that data into SQL table using SQL management studio,

But still if you want to go by C#, then you can get all list items using below code and then insert into SQL table

using ( SPSite site = new SPSite ("http://moss/sites/yousitename"))

  SPWeb myWeb = site.OpenWeb();
  SPList target = myWeb.Lists["YourListName"];
  SPListItems items = list.Items;

for more information check this link: https://social.msdn.microsoft.com/Forums/en-US/5d61926a-9a18-422f-a34a-dda3e8b3eab1/how-to-export-data-from-a-sharepoint-list-to-a-sql-database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.