Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

How to get DataTable from itemCollection in Sharepoint 2013 CSOM

$
0
0

Hi,

i need to get the DataTable from the ListItemCollection using CSOM.

Currently i am doing with foreach loop to get the DataTable but i have more than 40 fields so how can i get DataTable directly from the ListItemCollection

Below is the current code:

  foreach (ListItem item in itemCollection)
                {
                    DataRow dr = dt.NewRow();
                    dr["field1"] = Convert.ToString(item["field1"]);
                    dr["field2"] = Convert.ToString(item["field2"]);                  
                    dt.Rows.Add(dr);
                }

in SharePoint 2010 we can perform the same using SPListItemCollection.GetDataTable(),i need similar to this in SharePoint 2013 CSOM.

Thanks in advance.

Suresh T G


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>